Unverified Commit afeb404c authored by Donny/강동윤's avatar Donny/강동윤 Committed by GitHub

refactor(turbopack): Disable tree shaking by default (#73421)

### What?

Disable tree shaking by default

### Why?

x-ref: https://vercel.slack.com/archives/C03EWR7LGEN/p1733106700499869

### How?
parent d19d26ff
...@@ -1246,7 +1246,7 @@ impl NextConfig { ...@@ -1246,7 +1246,7 @@ impl NextConfig {
#[turbo_tasks::function] #[turbo_tasks::function]
pub fn tree_shaking_mode_for_foreign_code( pub fn tree_shaking_mode_for_foreign_code(
&self, &self,
is_development: bool, _is_development: bool,
) -> Vc<OptionTreeShaking> { ) -> Vc<OptionTreeShaking> {
let tree_shaking = self let tree_shaking = self
.experimental .experimental
...@@ -1257,19 +1257,13 @@ impl NextConfig { ...@@ -1257,19 +1257,13 @@ impl NextConfig {
OptionTreeShaking(match tree_shaking { OptionTreeShaking(match tree_shaking {
Some(false) => Some(TreeShakingMode::ReexportsOnly), Some(false) => Some(TreeShakingMode::ReexportsOnly),
Some(true) => Some(TreeShakingMode::ModuleFragments), Some(true) => Some(TreeShakingMode::ModuleFragments),
None => { None => Some(TreeShakingMode::ReexportsOnly),
if is_development {
Some(TreeShakingMode::ReexportsOnly)
} else {
Some(TreeShakingMode::ModuleFragments)
}
}
}) })
.cell() .cell()
} }
#[turbo_tasks::function] #[turbo_tasks::function]
pub fn tree_shaking_mode_for_user_code(&self, is_development: bool) -> Vc<OptionTreeShaking> { pub fn tree_shaking_mode_for_user_code(&self, _is_development: bool) -> Vc<OptionTreeShaking> {
let tree_shaking = self let tree_shaking = self
.experimental .experimental
.turbo .turbo
...@@ -1279,13 +1273,7 @@ impl NextConfig { ...@@ -1279,13 +1273,7 @@ impl NextConfig {
OptionTreeShaking(match tree_shaking { OptionTreeShaking(match tree_shaking {
Some(false) => Some(TreeShakingMode::ReexportsOnly), Some(false) => Some(TreeShakingMode::ReexportsOnly),
Some(true) => Some(TreeShakingMode::ModuleFragments), Some(true) => Some(TreeShakingMode::ModuleFragments),
None => { None => Some(TreeShakingMode::ReexportsOnly),
if is_development {
Some(TreeShakingMode::ReexportsOnly)
} else {
Some(TreeShakingMode::ModuleFragments)
}
}
}) })
.cell() .cell()
} }
......
...@@ -15604,37 +15604,37 @@ ...@@ -15604,37 +15604,37 @@
"runtimeError": false "runtimeError": false
}, },
"test/production/app-dir/actions-tree-shaking/basic/basic.test.ts": { "test/production/app-dir/actions-tree-shaking/basic/basic.test.ts": {
"passed": [ "passed": [],
"failed": [
"actions-tree-shaking - basic should not have the unused action in the manifest" "actions-tree-shaking - basic should not have the unused action in the manifest"
], ],
"failed": [],
"pending": [], "pending": [],
"flakey": [], "flakey": [],
"runtimeError": false "runtimeError": false
}, },
"test/production/app-dir/actions-tree-shaking/mixed-module-actions/mixed-module-actions-edge.test.ts": { "test/production/app-dir/actions-tree-shaking/mixed-module-actions/mixed-module-actions-edge.test.ts": {
"passed": [ "passed": [],
"failed": [
"actions-tree-shaking - mixed-module-actions should not do tree shake for cjs module when import server actions" "actions-tree-shaking - mixed-module-actions should not do tree shake for cjs module when import server actions"
], ],
"failed": [],
"pending": [], "pending": [],
"flakey": [], "flakey": [],
"runtimeError": false "runtimeError": false
}, },
"test/production/app-dir/actions-tree-shaking/mixed-module-actions/mixed-module-actions.test.ts": { "test/production/app-dir/actions-tree-shaking/mixed-module-actions/mixed-module-actions.test.ts": {
"passed": [ "passed": [],
"failed": [
"actions-tree-shaking - mixed-module-actions should not do tree shake for cjs module when import server actions" "actions-tree-shaking - mixed-module-actions should not do tree shake for cjs module when import server actions"
], ],
"failed": [],
"pending": [], "pending": [],
"flakey": [], "flakey": [],
"runtimeError": false "runtimeError": false
}, },
"test/production/app-dir/actions-tree-shaking/reexport/reexport-edge.test.ts": { "test/production/app-dir/actions-tree-shaking/reexport/reexport-edge.test.ts": {
"passed": [ "passed": [],
"actions-tree-shaking - reexport should not have the unused action in the manifest"
],
"failed": [ "failed": [
"actions-tree-shaking - reexport should not tree-shake namespace exports the manifest",
"actions-tree-shaking - reexport should not have the unused action in the manifest",
"actions-tree-shaking - reexport should keep all the action exports for namespace export case on client layer" "actions-tree-shaking - reexport should keep all the action exports for namespace export case on client layer"
], ],
"pending": [], "pending": [],
...@@ -15642,10 +15642,10 @@ ...@@ -15642,10 +15642,10 @@
"runtimeError": false "runtimeError": false
}, },
"test/production/app-dir/actions-tree-shaking/reexport/reexport.test.ts": { "test/production/app-dir/actions-tree-shaking/reexport/reexport.test.ts": {
"passed": [ "passed": [],
"actions-tree-shaking - reexport should not have the unused action in the manifest"
],
"failed": [ "failed": [
"actions-tree-shaking - reexport should not tree-shake namespace exports the manifest",
"actions-tree-shaking - reexport should not have the unused action in the manifest",
"actions-tree-shaking - reexport should keep all the action exports for namespace export case on client layer" "actions-tree-shaking - reexport should keep all the action exports for namespace export case on client layer"
], ],
"pending": [], "pending": [],
...@@ -15653,19 +15653,19 @@ ...@@ -15653,19 +15653,19 @@
"runtimeError": false "runtimeError": false
}, },
"test/production/app-dir/actions-tree-shaking/shared-module-actions/shared-module-actions-edge.test.ts": { "test/production/app-dir/actions-tree-shaking/shared-module-actions/shared-module-actions-edge.test.ts": {
"passed": [ "passed": [],
"failed": [
"actions-tree-shaking - shared-module-actions should not have the unused action in the manifest" "actions-tree-shaking - shared-module-actions should not have the unused action in the manifest"
], ],
"failed": [],
"pending": [], "pending": [],
"flakey": [], "flakey": [],
"runtimeError": false "runtimeError": false
}, },
"test/production/app-dir/actions-tree-shaking/shared-module-actions/shared-module-actions.test.ts": { "test/production/app-dir/actions-tree-shaking/shared-module-actions/shared-module-actions.test.ts": {
"passed": [ "passed": [],
"failed": [
"actions-tree-shaking - shared-module-actions should not have the unused action in the manifest" "actions-tree-shaking - shared-module-actions should not have the unused action in the manifest"
], ],
"failed": [],
"pending": [], "pending": [],
"flakey": [], "flakey": [],
"runtimeError": false "runtimeError": false
...@@ -15689,10 +15689,10 @@ ...@@ -15689,10 +15689,10 @@
"runtimeError": false "runtimeError": false
}, },
"test/production/app-dir/actions-tree-shaking/client-actions-tree-shaking/client-actions-tree-shaking.test.ts": { "test/production/app-dir/actions-tree-shaking/client-actions-tree-shaking/client-actions-tree-shaking.test.ts": {
"passed": [ "passed": [],
"failed": [
"app-dir - client-actions-tree-shaking should not bundle unused server reference id in client bundles" "app-dir - client-actions-tree-shaking should not bundle unused server reference id in client bundles"
], ],
"failed": [],
"pending": [], "pending": [],
"flakey": [], "flakey": [],
"runtimeError": false "runtimeError": false
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment