diff options
author | Bartek IwaĆczuk <biwanczuk@gmail.com> | 2023-03-20 14:05:13 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-03-20 14:05:13 -0400 |
commit | cd53ab5427811bddbed1c30d3733e1df87bb23f9 (patch) | |
tree | 0e2ea8e1b45f2d1d4acd20b666ae1d52d40940c6 /cli/node | |
parent | d78db7c0910aded010c2faee9a8c0f128f513985 (diff) |
refactor(ext/node): untangle dependencies between js files (#18284)
Moving some code around in `ext/node` is it's a bit better well defined
and makes it possible for others to embed it.
I expect to see no difference in startup perf with this change.
Diffstat (limited to 'cli/node')
-rw-r--r-- | cli/node/mod.rs | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/cli/node/mod.rs b/cli/node/mod.rs index 8a2f988e1..4cbb1ef05 100644 --- a/cli/node/mod.rs +++ b/cli/node/mod.rs @@ -680,7 +680,9 @@ pub fn translate_cjs_to_esm( let mut handled_reexports: HashSet<String> = HashSet::default(); let mut source = vec![ - r#"const require = Deno[Deno.internal].require.Module.createRequire(import.meta.url);"#.to_string(), + r#"import {createRequire as __internalCreateRequire} from "node:module"; + const require = __internalCreateRequire(import.meta.url);"# + .to_string(), ]; let analysis = perform_cjs_analysis( |