Skip to content

Commit 985a3c7

Browse files
Merge pull request #12 from nodejs/commonjs-extension-resolution-loader-improvements
2 parents 3401c0a + c23832a commit 985a3c7

File tree

18 files changed

+285
-15
lines changed

18 files changed

+285
-15
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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
!node_modules/

commonjs-extension-resolution-loader/test/fixtures/es-module-specifiers/node_modules/explicit-main/entry.mjs

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

commonjs-extension-resolution-loader/test/fixtures/es-module-specifiers/node_modules/explicit-main/package.json

Lines changed: 3 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

commonjs-extension-resolution-loader/test/fixtures/es-module-specifiers/node_modules/implicit-main-type-commonjs/entry.mjs

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

commonjs-extension-resolution-loader/test/fixtures/es-module-specifiers/node_modules/implicit-main-type-commonjs/package.json

Lines changed: 4 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

commonjs-extension-resolution-loader/test/fixtures/es-module-specifiers/node_modules/implicit-main-type-module/entry.js

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

commonjs-extension-resolution-loader/test/fixtures/es-module-specifiers/node_modules/implicit-main-type-module/entry.mjs

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

commonjs-extension-resolution-loader/test/fixtures/es-module-specifiers/node_modules/implicit-main-type-module/package.json

Lines changed: 4 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

commonjs-extension-resolution-loader/test/fixtures/es-module-specifiers/node_modules/implicit-main/entry.js

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)