We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
When bundling, a subpath import to a node internal module (eg like 'stream') is not resolved by esbuild, leading to an error.
Reproduction case
package.json
{ "type": "module", "scripts": { "run-direct": "node main-direct.js", "run-subpathimport": "node main-subpathimport.js", "bundle-direct": "esbuild --bundle --platform=node main-direct.js", "bundle-subpathimport": "esbuild --bundle --platform=node main-subpathimport.js" }, "imports": { "#stream": { "node": "stream", "default": "./stub.js" } }, "devDependencies": { "esbuild": "0.19.5" } }
main-direct.js
import * as stream from 'stream'; console.log(Object.keys(stream));
main-subpathimport.js
import * as stream from '#stream'; console.log(Object.keys(stream));
stub.js
export const test = 'test';
npm run run-direct, npm run run-subpathimport, npm run bundle-direct all works correctly
npm run run-direct
npm run run-subpathimport
npm run bundle-direct
npm run bundle-subpathimport fails with error
npm run bundle-subpathimport
✘ [ERROR] Could not resolve "#stream" main-subpathimport.js:1:24: 1 │ import * as stream from '#stream'; ╵ ~~~~~~~~~ The remapped path "stream" could not be resolved: package.json:11:14: 11 │ "node": "stream", ╵ ~~~~~~~~ You can mark the path "#stream" as external to exclude it from the bundle, which will remove this error and leave the unresolved path in the bundle.
✘ [ERROR] Could not resolve "#stream"
main-subpathimport.js:1:24: 1 │ import * as stream from '#stream'; ╵ ~~~~~~~~~
The remapped path "stream" could not be resolved:
package.json:11:14: 11 │ "node": "stream", ╵ ~~~~~~~~
You can mark the path "#stream" as external to exclude it from the bundle, which will remove this error and leave the unresolved path in the bundle.
The error The remapped path "stream" could not be resolved should not happen in that case ?
The remapped path "stream" could not be resolved
The text was updated successfully, but these errors were encountered:
83e8c7f
No branches or pull requests
When bundling, a subpath import to a node internal module (eg like 'stream') is not resolved by esbuild, leading to an error.
Reproduction case
package.json
main-direct.js
main-subpathimport.js
stub.js
npm run run-direct
,npm run run-subpathimport
,npm run bundle-direct
all works correctlynpm run bundle-subpathimport
fails with errorThe error
The remapped path "stream" could not be resolved
should not happen in that case ?The text was updated successfully, but these errors were encountered: