-
-
Notifications
You must be signed in to change notification settings - Fork 626
Closed
Labels
Description
- Rollup Plugin Name: @rollup/plugin-node-resolve
- Rollup Plugin Version: 13.3.0
- Rollup Version: 2.75.6
- Operating System (or Browser): Windows 11
- Node Version: 16.15.0
- Link to reproduction (
⚠️ read below): https://github.com/philfontaine/bug-rollup-string-encoder
Expected Behavior
node modules with trailing slash should not be resolved as built-in, as explained in this comment nodejs/readable-stream#391 (comment)
I can't find the supporting docs to confirm that's how modules with forward slash should be resolved, but it seems to be this way since it breaks when it's required from the rollup bundle.
In my use case, I have a bunch of libs that depend on readable-stream@3 which contains require('string_decoder/').
Actual Behavior
The plugin thinks it's built-in because the is-builtin-module module returns true, so it does not resolve it.
Additional Information
To reproduce on the repo:
- yarn build
- node dist/index.js
To fix:
Seems like it just needs an endsWith('/') check on the module name to confirm that it's not built-in.
This maybe should be fixed upstream on the is-builtin-module package?
Reactions are currently unavailable
