You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'd like to request that esbuild-register applies transformations to ESM dependencies. It currently can't import packages with type: 'module' (unless the current project is also ESM):
> esno src/index.ts
internal/modules/cjs/loader.js:1080
throw new ERR_REQUIRE_ESM(filename, parentPath, packageJsonPath);
^
Error [ERR_REQUIRE_ESM]: Must use import to load ES Module: /node-project/node_modules/.pnpm/vue-ast-utils@1.0.1_@vue+compiler-core@3.0.11/node_modules/vue-ast-utils/dist/index.js
require() of ES modules is not supported.
require() of /node-project/node_modules/.pnpm/vue-ast-utils@1.0.1_@vue+compiler-core@3.0.11/node_modules/vue-ast-utils/dist/index.js from /node-project/src/lib/selector/index.ts is an ES module file as it is a .js file whose nearest parent package.json contains "type": "module" which defines all .js files in that package scope as ES modules.
Instead rename index.js to end in .cjs, change the requiring code to use import(), or remove "type": "module" from /node-project/node_modules/.pnpm/vue-ast-utils@1.0.1_@vue+compiler-core@3.0.11/node_modules/vue-ast-utils/package.json.
at Module._extensions..js (internal/modules/cjs/loader.js:1080:13)
at Object.newLoader [as .js] (/node-project/node_modules/.pnpm/esbuild-register@2.4.0/node_modules/esbuild-register/dist/node.js:2262:9)
at Module.load (internal/modules/cjs/loader.js:928:32)
at Function.Module._load (internal/modules/cjs/loader.js:769:14)
at Module.require (internal/modules/cjs/loader.js:952:19)
at require (internal/modules/cjs/helpers.js:88:18)
at Object.<anonymous> (/node-project/src/lib/selector/index.ts:2:27)
at Module._compile (internal/modules/cjs/loader.js:1063:30)
at Module._compile (/node-project/node_modules/.pnpm/esbuild-register@2.4.0/node_modules/esbuild-register/dist/node.js:2258:26)
at Module._extensions..js (internal/modules/cjs/loader.js:1092:10) {
code: 'ERR_REQUIRE_ESM'
}
I think this problem will be become more common in the near future due to sindresorhus/meta#15.
This is similar to #12, but I cannot add type: 'module' because I'm only using esbuild-register in development but building to CJS for production.
I'd like to request that esbuild-register applies transformations to ESM dependencies. It currently can't import packages with
type: 'module'
(unless the current project is also ESM):I think this problem will be become more common in the near future due to sindresorhus/meta#15.
This is similar to #12, but I cannot add
type: 'module'
because I'm only using esbuild-register in development but building to CJS for production.Similar issue from
esm
: standard-things/esm#868The text was updated successfully, but these errors were encountered: