Skip to content
New issue

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

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

Already on GitHub? # to your account

add enable_edge_node_externals #6562

Merged
merged 2 commits into from
Nov 24, 2023
Merged

add enable_edge_node_externals #6562

merged 2 commits into from
Nov 24, 2023

Conversation

sokra
Copy link
Member

@sokra sokra commented Nov 24, 2023

Description

Some edge runtimes allow additional node.js builtins

Testing Instructions

Closes PACK-2030

Copy link

vercel bot commented Nov 24, 2023

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
examples-basic-web 🔄 Building (Inspect) Visit Preview 💬 Add feedback Nov 24, 2023 10:30am
examples-kitchensink-blog 🔄 Building (Inspect) Visit Preview 💬 Add feedback Nov 24, 2023 10:30am
examples-nonmonorepo 🔄 Building (Inspect) Visit Preview 💬 Add feedback Nov 24, 2023 10:30am
examples-svelte-web 🔄 Building (Inspect) Visit Preview 💬 Add feedback Nov 24, 2023 10:30am
turbo-docs ✅ Ready (Inspect) Visit Preview 💬 Add feedback Nov 24, 2023 10:30am
turbo-turbo-tracing-next-plugin ❌ Failed (Inspect) Nov 24, 2023 10:30am
turbo-with-mongodb-mongoose ❌ Failed (Inspect) Nov 24, 2023 10:30am
7 Ignored Deployments
Name Status Preview Comments Updated (UTC)
examples-cra-web ⬜️ Ignored (Inspect) Visit Preview Nov 24, 2023 10:30am
examples-designsystem-docs ⬜️ Ignored (Inspect) Visit Preview Nov 24, 2023 10:30am
examples-gatsby-web ⬜️ Ignored (Inspect) Visit Preview Nov 24, 2023 10:30am
examples-native-web ⬜️ Ignored (Inspect) Visit Preview Nov 24, 2023 10:30am
examples-tailwind-web ⬜️ Ignored (Inspect) Visit Preview Nov 24, 2023 10:30am
examples-vite-web ⬜️ Ignored (Inspect) Nov 24, 2023 10:30am
turbo-site ⬜️ Ignored (Inspect) Visit Preview Nov 24, 2023 10:30am

Copy link
Contributor

github-actions bot commented Nov 24, 2023

🟢 Turbopack Benchmark CI successful 🟢

Thanks

Copy link
Contributor

✅ This change can build next-swc

Copy link
Contributor

github-actions bot commented Nov 24, 2023

⚠️ CI failed ⚠️

The following steps have failed in CI:

  • Turbopack Rust tests (mac/win, non-blocking)

See workflow summary for details

Copy link
Contributor

Linux Benchmark for 222e570

Click to view benchmark
Test Base PR % Significant %
bench_hmr_to_commit/Turbopack CSR/1000 modules 21.97ms ± 0.88ms 22.14ms ± 0.90ms +0.75%
bench_hmr_to_eval/Turbopack CSR/1000 modules 21.63ms ± 0.89ms 21.59ms ± 0.90ms -0.16%
bench_startup/Turbopack CSR/1000 modules 1092.32ms ± 6.40ms 1107.62ms ± 12.10ms +1.40%

Copy link
Contributor

Linux Benchmark for 0972ee8

Click to view benchmark
Test Base PR % Significant %
bench_hmr_to_commit/Turbopack CSR/1000 modules 21.67ms ± 0.89ms 21.50ms ± 0.84ms -0.77%
bench_hmr_to_eval/Turbopack CSR/1000 modules 21.03ms ± 0.83ms 21.02ms ± 0.81ms -0.04%
bench_startup/Turbopack CSR/1000 modules 1090.17ms ± 6.86ms 1097.87ms ± 18.89ms +0.71%

@sokra sokra merged commit c858540 into main Nov 24, 2023
@sokra sokra deleted the sokra/node-edge-externals branch November 24, 2023 11:58
Comment on lines +227 to +237
pub async fn supports_commonjs_externals(self: Vc<Self>) -> Result<Vc<bool>> {
let this = self.await?;
Ok(match this.execution {
ExecutionEnvironment::NodeJsBuildTime(..) | ExecutionEnvironment::NodeJsLambda(_) => {
Vc::cell(true)
}
ExecutionEnvironment::Browser(_) => Vc::cell(false),
ExecutionEnvironment::EdgeWorker(_) => Vc::cell(true),
ExecutionEnvironment::Custom(_) => todo!(),
})
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
pub async fn supports_commonjs_externals(self: Vc<Self>) -> Result<Vc<bool>> {
let this = self.await?;
Ok(match this.execution {
ExecutionEnvironment::NodeJsBuildTime(..) | ExecutionEnvironment::NodeJsLambda(_) => {
Vc::cell(true)
}
ExecutionEnvironment::Browser(_) => Vc::cell(false),
ExecutionEnvironment::EdgeWorker(_) => Vc::cell(true),
ExecutionEnvironment::Custom(_) => todo!(),
})
}
pub fn supports_commonjs_externals(&self) -> Vc<bool> {
match self.execution {
ExecutionEnvironment::NodeJsBuildTime(..) | ExecutionEnvironment::NodeJsLambda(_) => {
Vc::cell(true)
}
ExecutionEnvironment::Browser(_) => Vc::cell(false),
ExecutionEnvironment::EdgeWorker(_) => Vc::cell(true),
ExecutionEnvironment::Custom(_) => todo!(),
}
}

would love a linter for this

AhmedBaset pushed a commit to AhmedBaset/next.js that referenced this pull request Nov 26, 2023
### What?

Edge runtime allow additional node.js builtins

see vercel/turborepo#6562


Closes PACK-2031

---------

Co-authored-by: Tim Neutkens <tim@timneutkens.nl>
ForsakenHarmony pushed a commit to vercel/next.js that referenced this pull request Jul 25, 2024
### Description

Some edge runtimes allow additional node.js builtins

### Testing Instructions

<!--
  Give a quick description of steps to test your changes.
-->


Closes PACK-2030
ForsakenHarmony pushed a commit to vercel/next.js that referenced this pull request Jul 29, 2024
### Description

Some edge runtimes allow additional node.js builtins

### Testing Instructions

<!--
  Give a quick description of steps to test your changes.
-->


Closes PACK-2030
ForsakenHarmony pushed a commit to vercel/next.js that referenced this pull request Jul 29, 2024
### Description

Some edge runtimes allow additional node.js builtins

### Testing Instructions

<!--
  Give a quick description of steps to test your changes.
-->


Closes PACK-2030
ForsakenHarmony pushed a commit to vercel/next.js that referenced this pull request Aug 1, 2024
### Description

Some edge runtimes allow additional node.js builtins

### Testing Instructions

<!--
  Give a quick description of steps to test your changes.
-->


Closes PACK-2030
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants