zip-it-and-ship-it
zip-it-and-ship-it copied to clipboard
[esbuild] Wrong version of external module selected when multiple exist
- Do you want to request a feature or report a bug?
🐞
- What is the current behavior?
When a module is flagged as external, the following happens:
- the
require
will be left untouched by esbuild (e.g.require('foobar')
) -
zip-it-and-ship-it
will try to find the module _from the root _directory — if it exists atnode_modules/foobar
, that directory will be included in the zipped artefact - when the function runs,
require('foobar')
will resolve to the directory created in 2
This can break if multiple versions of foobar
exist and a transitive dependency requires one that is different from the version at the root level — e.g. we'll bundle node_modules/foobar
instead of node_modules/some-other-module/node_modules/foobar
.
- If the current behavior is a bug, please provide the steps to reproduce.
- Create a project with the module structure described above
- Verify that the wrong version of the external module is included in the zip
- What is the expected behavior?
Described above.
- Please mention your node.js, and operating system version.
N/A