Skip to content

Commit

Permalink
next.js config
Browse files Browse the repository at this point in the history
  • Loading branch information
kdy1 committed Nov 16, 2023
1 parent 69d5a49 commit daba94e
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 0 deletions.
3 changes: 3 additions & 0 deletions packages/next-swc/crates/next-core/src/next_client/context.rs
Original file line number Diff line number Diff line change
Expand Up @@ -274,6 +274,8 @@ pub async fn get_client_module_options_context(
..module_options_context.clone()
};

let use_lightningcss = *next_config.use_lightningcss().await?;

let module_options_context = ModuleOptionsContext {
// We don't need to resolve React Refresh for each module. Instead,
// we try resolve it once at the root and pass down a context to all
Expand Down Expand Up @@ -302,6 +304,7 @@ pub async fn get_client_module_options_context(
),
],
custom_rules,
use_lightningcss,
..module_options_context
}
.cell();
Expand Down
9 changes: 9 additions & 0 deletions packages/next-swc/crates/next-core/src/next_config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -503,6 +503,8 @@ pub struct ExperimentalConfig {
/// (doesn't apply to Turbopack).
webpack_build_worker: Option<bool>,
worker_threads: Option<bool>,

use_lightningcss: Option<bool>,
}

#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, TraceRawVcs)]
Expand Down Expand Up @@ -754,6 +756,13 @@ impl NextConfig {
pub async fn enable_taint(self: Vc<Self>) -> Result<Vc<bool>> {
Ok(Vc::cell(self.await?.experimental.taint.unwrap_or(false)))
}

#[turbo_tasks::function]
pub async fn use_lightningcss(self: Vc<Self>) -> Result<Vc<bool>> {
Ok(Vc::cell(
self.await?.experimental.use_lightningcss.unwrap_or(false),
))
}
}

fn next_configs() -> Vc<Vec<String>> {
Expand Down
3 changes: 3 additions & 0 deletions packages/next-swc/crates/next-core/src/next_server/context.rs
Original file line number Diff line number Diff line change
Expand Up @@ -360,9 +360,12 @@ pub async fn get_server_module_options_context(
},
);

let use_lightningcss = *next_config.use_lightningcss().await?;

let module_options_context = ModuleOptionsContext {
execution_context: Some(execution_context),
esm_url_rewrite_behavior: url_rewrite_behavior,
use_lightningcss,
..Default::default()
};

Expand Down

0 comments on commit daba94e

Please sign in to comment.