1
0
Fork 0
mirror of https://github.com/denoland/deno.git synced 2024-11-28 16:20:57 -05:00

fix: loading built-in Node modules embedded in the binary (#17777)

Fixes bug introduced in ed3a7ce2f7 that
caused errors when loading built-in Node modules, when using "deno_graph".
This commit is contained in:
Bartek Iwańczuk 2023-02-14 16:48:27 +01:00 committed by GitHub
parent b3c85c3548
commit 1d00bbe47e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 11 additions and 0 deletions

View file

@ -534,6 +534,11 @@ impl ProcState {
match maybe_resolved {
Some((found_referrer, Resolution::Ok(resolved))) => {
let specifier = &resolved.specifier;
if specifier.scheme() == "node" {
return node::resolve_builtin_node_module(specifier.path());
}
if let Ok(reference) = NpmPackageReference::from_specifier(specifier)
{
if !self.options.unstable()

View file

@ -1,2 +1,4 @@
import { createRequire } from "node:module";
console.log(createRequire);
import process from "node:process";
console.log(process.version);

View file

@ -1 +1,2 @@
[Function: createRequire]
v[WILDCARD].[WILDCARD].[WILDCARD]

View file

@ -1,2 +1,4 @@
import { createRequire } from "node:module";
console.log(createRequire);
import process from "node:process";
console.log(process.version);

View file

@ -1 +1,2 @@
[Function: createRequire]
v[WILDCARD].[WILDCARD].[WILDCARD]