Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: Move tree shaking config to experimental.turbo #69050

Merged
merged 3 commits into from
Aug 20, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 7 additions & 3 deletions crates/next-core/src/next_config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -399,6 +399,7 @@ pub struct ExperimentalTurboConfig {
pub resolve_alias: Option<IndexMap<RcStr, JsonValue>>,
pub resolve_extensions: Option<Vec<RcStr>>,
pub use_swc_css: Option<bool>,
pub tree_shaking: Option<bool>,
}

#[derive(Clone, Debug, PartialEq, Eq, Serialize, Deserialize, TraceRawVcs)]
Expand Down Expand Up @@ -561,8 +562,6 @@ pub struct ExperimentalConfig {
/// (doesn't apply to Turbopack).
webpack_build_worker: Option<bool>,
worker_threads: Option<bool>,

tree_shaking: Option<bool>,
}

#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, TraceRawVcs)]
Expand Down Expand Up @@ -1105,7 +1104,12 @@ impl NextConfig {
self: Vc<Self>,
is_development: bool,
) -> Result<Vc<OptionTreeShaking>> {
let tree_shaking = self.await?.experimental.tree_shaking;
let tree_shaking = self
.await?
.experimental
.turbo
.as_ref()
.and_then(|v| v.tree_shaking);

Ok(OptionTreeShaking(match tree_shaking {
Some(false) => Some(TreeShakingMode::ReexportsOnly),
Expand Down
5 changes: 5 additions & 0 deletions packages/next/src/server/config-shared.ts
Original file line number Diff line number Diff line change
Expand Up @@ -153,6 +153,11 @@ export interface ExperimentalTurboOptions {
* A target memory limit for turbo, in bytes.
*/
memoryLimit?: number

/**
* Enable tree shaking for the turbopack dev server and build.
*/
treeShaking?: boolean
}

export interface WebpackConfigContext {
Expand Down
Loading