-
-
Notifications
You must be signed in to change notification settings - Fork 591
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
feat(node-resolve): dedupe preferBuiltins protocol #1212
Conversation
Thanks for the PR! I’m wondering if this really should be part of this plug-in though or a separate plug-in? Also I reckon one of the reasons for the new prefix was to prevent name collisions between node built-ins and real packages, so I’m not sure we should provide an option to go in the direction from prefix to no prefix? |
I thought about it too, but if it's a separate plugin, the only place it'll be useful are in projects that externalize all deps and builtin modules (bundle source code only). But in that case, the source code would've been written with only Deduping protocols would mostly be handy when bundling third-party packages which
Good point. It would a problem if the project/package used |
Hmm. Yeh going either way is potentially destructive. I’m still not sure it needs to be in this plug-in vs another one. I get that the prefix is a node thing which is why it could fall in here, but also it could easily be an isolated plug-in. Will see what other maintainers think |
A bit related, we should probably always have this plug-in mark |
It looks like it's already handled as |
I agree with this |
I'll make this as a separate plugin then, thanks for the feedback! |
Thanks. Please make sure to add it to |
Rollup Plugin Name:
node-resolve
This PR contains:
Are tests included?
Breaking Changes?
If yes, then include "BREAKING CHANGES:" in the first commit message body, followed by a description of what is breaking.
List any relevant issue numbers:
Description
When bundling a library that uses both
node:fs
andfs
, it can be deduped as a singlenode:fs
orfs
import instead, slightly reducing the bundle size. This can often happen when using third-party libraries.To enable this optimization,
preferBuiltins
now also acceptsprefer-protocol
orprefer-no-protocol
to dedupe to eithernode:fs
orfs
, depending on the users node target version that supports it.