diff --git a/src/esm/hook/resolve.ts b/src/esm/hook/resolve.ts index 3bca24d08..aafbe85de 100644 --- a/src/esm/hook/resolve.ts +++ b/src/esm/hook/resolve.ts @@ -277,7 +277,7 @@ export const resolve: resolve = async ( } // If not bare specifier - if (acceptsQuery) { + if (!isBarePackageName.test(specifier)) { try { return await tryExtensions(specifier, context, nextResolve); } catch {} diff --git a/tests/specs/smoke.ts b/tests/specs/smoke.ts index 9809c5346..35f0de252 100644 --- a/tests/specs/smoke.ts +++ b/tests/specs/smoke.ts @@ -35,9 +35,10 @@ export default testSuite(async ({ describe }, { tsx, supports, version }: NodeAp import * as pkgCommonjs from 'pkg-commonjs'; // Named exports from CommonJS - import { cjsJs } from 'pkg-commonjs/cjs.js'; + import { cjsJs } from 'pkg-commonjs/cjs'; import * as pkgModule from 'pkg-module'; + import 'pkg-module/index'; import 'pkg-module/empty-export'; // implicit directory & extension // .js in esm syntax @@ -189,13 +190,14 @@ export default testSuite(async ({ describe }, { tsx, supports, version }: NodeAp // Dependencies import * as pkgCommonjs from 'pkg-commonjs'; import * as pkgModule from 'pkg-module'; + import 'pkg-module/index'; // Resolving TS files in dependencies (e.g. implicit extensions & export maps) import 'pkg-commonjs/ts.js'; import 'pkg-module/ts.js'; // Named exports from CommonJS - import { cjsJs } from 'pkg-commonjs/cjs.js'; + import { cjsJs } from 'pkg-commonjs/cjs'; // .js in esm syntax import * as js from './js/index.js';