Skip to content

Commit

Permalink
fix(turbopack): don't parse .ts files as .tsx
Browse files Browse the repository at this point in the history
  • Loading branch information
ForsakenHarmony committed Jan 26, 2024
1 parent 76641da commit 4cf46f0
Show file tree
Hide file tree
Showing 5 changed files with 50 additions and 50 deletions.
68 changes: 34 additions & 34 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -37,11 +37,11 @@ swc_core = { version = "0.87.28", features = [
testing = { version = "0.35.14" }

# Turbo crates
turbopack-binding = { git = "https://github.com/vercel/turbo.git", tag = "turbopack-240126.2" }
turbopack-binding = { git = "https://github.com/vercel/turbo.git", branch = "hrmny/pack-2302-dont-parse-ts-files-as-tsx" } # last tag: "turbopack-240126.2"
# [TODO]: need to refactor embed_directory! macro usages, as well as resolving turbo_tasks::function, macros..
turbo-tasks = { git = "https://github.com/vercel/turbo.git", tag = "turbopack-240126.2" }
turbo-tasks = { git = "https://github.com/vercel/turbo.git", branch = "hrmny/pack-2302-dont-parse-ts-files-as-tsx" } # last tag: "turbopack-240126.2"
# [TODO]: need to refactor embed_directory! macro usage in next-core
turbo-tasks-fs = { git = "https://github.com/vercel/turbo.git", tag = "turbopack-240126.2" }
turbo-tasks-fs = { git = "https://github.com/vercel/turbo.git", branch = "hrmny/pack-2302-dont-parse-ts-files-as-tsx" } # last tag: "turbopack-240126.2"

# General Deps

Expand Down
14 changes: 7 additions & 7 deletions packages/next-swc/crates/next-core/src/app_segment_config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -229,13 +229,13 @@ pub async fn parse_segment_config_from_source(

let result = &*parse(
source,
turbo_tasks::Value::new(
if path.path.ends_with(".ts") || path.path.ends_with(".tsx") {
EcmascriptModuleAssetType::Typescript
} else {
EcmascriptModuleAssetType::Ecmascript
},
),
turbo_tasks::Value::new(if path.path.ends_with(".ts") {
EcmascriptModuleAssetType::Typescript { tsx: false }
} else if path.path.ends_with(".tsx") {
EcmascriptModuleAssetType::Typescript { tsx: true }
} else {
EcmascriptModuleAssetType::Ecmascript
}),
EcmascriptInputTransforms::empty(),
)
.await?;
Expand Down
2 changes: 1 addition & 1 deletion packages/next/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -194,7 +194,7 @@
"@types/ws": "8.2.0",
"@vercel/ncc": "0.34.0",
"@vercel/nft": "0.26.2",
"@vercel/turbopack-ecmascript-runtime": "https://gitpkg-fork.vercel.sh/vercel/turbo/crates/turbopack-ecmascript-runtime/js?turbopack-240126.2",
"@vercel/turbopack-ecmascript-runtime": "https://gitpkg-fork.vercel.sh/vercel/turbo/crates/turbopack-ecmascript-runtime/js?88b0a69c2275df895ed87b1af2f4307ddca50370",
"acorn": "8.5.0",
"amphtml-validator": "1.0.35",
"anser": "1.4.9",
Expand Down
10 changes: 5 additions & 5 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 4cf46f0

Please sign in to comment.