New issue
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
Allow package.json dependencies to be selectively transpiled / bundled #38
Comments
I had the same problem when upgrading from node-fetch 2.x (non ESM) to node-fetch 3.x (ESM). It's quite surprisingly that esbuild-runner automatically externalize direct dependencies in package.json which is not the behavior of esbuild. |
The esbuild-node-externals plugin allows you to specify an
allowList
parameter for including dependencies into the bundle.Why would you want this? For example:
"foo": "link:.src/some/path/foo"
in the package.json. These aren't really external dependencies and they should be bundled/transpiled, they're just a convenient way to make bits of the source appear as top-level packages forimport
.In our case, the first bullet prevents us from using esbuild-runner for some of our tools: our source tree is pure ESM, esr transpiles to CJS for running under node except the internally linked entries defined in packages.json aren't being bundled, so the result doesn't run.
I would like to suggest one or two options:
allowList
orexternalsAllowList
, specifying dependencies that should be transpiled/bundled.If this is something you'd consider, I could try to make a PR.
The text was updated successfully, but these errors were encountered: