node
node copied to clipboard
[v18.x] esm: fix `--specifier-resolution=node` not preserving symlinks
Fixes https://github.com/nodejs/node/issues/47649
When you combine --experimental-specifier-resolution=node
and --preserve-symlinks
imports that were valid in node 14 fail.
While I recognise that this behaviour is experimental, and indeed removed in node 19, swapping to a loader for the simple case of appending .js
is quite a bit of effort - even if that effort will eventually need to be made.
Review requested:
- [ ] @nodejs/loaders
- [ ] @nodejs/modules
CI: https://ci.nodejs.org/job/node-test-pull-request/51410/
Thanks @aduh95 - if you could point me to some of the ESM loader packages that would be great - I did try to roll my own, and it mostly works, but it's not something I'd be comfortable using in production at all really, even once it stops being experimental.
An even better approach would be to just remove all our imports that use ambiguous paths - but that will be an ongoing effort.
CI: https://ci.nodejs.org/job/node-test-pull-request/51453/
CI: https://ci.nodejs.org/job/node-test-pull-request/53366/
Landed in a00464ee066991caa6f9b406cbf4e77f46791fbf