Skip to content

Commit 484e40a

Browse files
committed
Better isBuiltin check
1 parent 3401c0a commit 484e40a

File tree

1 file changed

+6
-6
lines changed
  • commonjs-extension-resolution-loader

1 file changed

+6
-6
lines changed

commonjs-extension-resolution-loader/loader.js

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1-
import { builtinModules } from 'node:module';
2-
import { dirname } from 'path';
3-
import { cwd } from 'process';
4-
import { fileURLToPath, pathToFileURL } from 'url';
5-
import { promisify } from 'util';
1+
import { isBuiltin } from 'node:module';
2+
import { dirname } from 'node:path';
3+
import { cwd } from 'node:process';
4+
import { fileURLToPath, pathToFileURL } from 'node:url';
5+
import { promisify } from 'node:util';
66

77
import resolveCallback from 'resolve/async.js';
88

@@ -14,7 +14,7 @@ const baseURL = pathToFileURL(cwd() + '/').href;
1414
export async function resolve(specifier, context, next) {
1515
const { parentURL = baseURL } = context;
1616

17-
if (specifier.startsWith('node:') || builtinModules.includes(specifier)) {
17+
if (isBuiltin(specifier)) {
1818
return next(specifier, context);
1919
}
2020

0 commit comments

Comments
 (0)