-
Notifications
You must be signed in to change notification settings - Fork 634
Closed
Description
What problem does this feature solve?
Instead of creating as few chunks as possible,
this mode will create separate chunks for all modules using the original module names as file names.
Use case
I'm using this rollup
preserveModules
option to build packages inside a mono-repo and I heavy rely on tree shaking to reduce the size of the final app bundle as much as possible.
E.g:
I have a UI package with a single index export which provides a series of components.
In some of the apps I use only one or two of the above mentioned components and I would like that only the code of these components is included in the final bundle.
What does the proposed API look like?
Right know this is implemented by rollup
using the following options:
Configuration example:
import { defineConfig } from "rolldown";
export default defineConfig({
input: ["src/entryA.js", "src/entryB.js"],
output: {
dir: "dist",
preserveModules: true,
preserveModulesRoot: 'src'
},
});
chocolateboy, thebanjomatic, brettsaunders21, iamchanii, RoenLie and 10 more