Skip to content

Commit e97565e

Browse files
authored
Ensure process.env.TURBOPACK is always set (#6116)
### Description Related to vercel/next.js#56496. Server Actions currently shows an error as it seems to use the react-dom-webpack version instead of react-dom-turbopack. This seems to be caused by the changes in vercel/next.js#56438 which checks for `process.env.TURBOPACK` which is not always set currently, unlike `process.turbopack`. This PR adds it in the other places where `process.turbopack` is set. <!-- ✍️ Write a short summary of your work. If necessary, include relevant screenshots. --> ### Testing Instructions <!-- Give a quick description of steps to test your changes. -->
1 parent dbc78d7 commit e97565e

File tree

4 files changed

+9
-2
lines changed

4 files changed

+9
-2
lines changed

crates/turbopack-cli/src/contexts.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -177,6 +177,7 @@ pub fn get_client_asset_context(
177177
fn client_defines(node_env: &NodeEnv) -> Vc<CompileTimeDefines> {
178178
compile_time_defines!(
179179
process.turbopack = true,
180+
process.env.TURBOPACK = true,
180181
process.env.NODE_ENV = node_env.to_string()
181182
)
182183
.cell()

crates/turbopack-tests/tests/execution.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -199,6 +199,7 @@ async fn run_test(resource: String) -> Result<Vc<RunTestResult>> {
199199
.defines(
200200
compile_time_defines!(
201201
process.turbopack = true,
202+
process.env.TURBOPACK = true,
202203
process.env.NODE_ENV = "development",
203204
)
204205
.cell(),

crates/turbopack-tests/tests/snapshot.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -214,6 +214,7 @@ async fn run_test(resource: String) -> Result<Vc<FileSystemPath>> {
214214

215215
let defines = compile_time_defines!(
216216
process.turbopack = true,
217+
process.env.TURBOPACK = true,
217218
process.env.NODE_ENV = "development",
218219
DEFINED_VALUE = "value",
219220
DEFINED_TRUE = true,

crates/turbopack/src/evaluate_context.rs

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -76,8 +76,12 @@ pub async fn node_evaluate_asset_context(
7676
transitions.unwrap_or_else(|| Vc::cell(Default::default())),
7777
CompileTimeInfo::builder(node_build_environment())
7878
.defines(
79-
compile_time_defines!(process.turbopack = true, process.env.NODE_ENV = node_env,)
80-
.cell(),
79+
compile_time_defines!(
80+
process.turbopack = true,
81+
process.env.NODE_ENV = node_env,
82+
process.env.TURBOPACK = true
83+
)
84+
.cell(),
8185
)
8286
.cell(),
8387
ModuleOptionsContext {

0 commit comments

Comments
 (0)