-
-
Notifications
You must be signed in to change notification settings - Fork 1.5k
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
preserveModules
, but one bundle per node_module
#5626
Labels
Comments
FWIW, I cleared up the current output via a custom const noise = new Set(['index', 'dist', 'src', 'source', 'distribution', 'node_modules', 'main', 'esm', 'cjs', 'build', 'built']);
// ...
entryFileNames(chunkInfo) {
if (chunkInfo.name.includes('node_modules')) {
const cleanName = chunkInfo.name
.split('/')
.filter(part => !noise.has(part))
.join('-');
return `node_modules/${cleanName}.js`;
}
return '[name].js'
}, Before
After
I found it on a similar (but very different) issue: #3684 (comment) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Feature Use Case
preserveModule
appears to be all or nothing. This means that each and every file, including multiple files undernode_modules
are bundled separately, often appearing as several[package]/index.js
files.I really liked the idea behind Snowpack, bundling each package in
node_modules
as its own bundle. I'm not asking for that kind of optimization here, but it's just to give an idea of the expected output.Feature Proposal
I'd love for a way to pick what's preserved and what not. The kind of granularity is up for debate. I think the most flexible API would look like
groupBy
, where the callback returns an ID and rollup just uses the ID to create a chunk.In my scenario, the callback would be:
or:
The text was updated successfully, but these errors were encountered: