Skip to content

Commit

Permalink
fix: resolve built-in modules as node:
Browse files Browse the repository at this point in the history
  • Loading branch information
pi0 committed Feb 26, 2025
1 parent a4782c4 commit 6fb091b
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion src/env.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { createResolver } from "exsolve";
import { builtinModules } from "node:module";
import { resolveAlias } from "pathe/utils";
import { createResolver } from "exsolve";
import type {
Preset,
Environment,
Expand Down Expand Up @@ -101,6 +102,12 @@ function resolveEnvPaths(
return id;
}
id = resolveAlias(id, env.alias);
if (id.startsWith("node:")) {
return id;
}
if (builtinModules.includes(id)) {
return `node:${id}`;
}
let resolved = resolveModulePath(id, { try: true });
if (!resolved && id.startsWith("unenv/")) {
resolved = resolveModulePath(id.replace("unenv/", "unenv-nightly/"), {
Expand Down

0 comments on commit 6fb091b

Please sign in to comment.