When an array of entry points is provided to Rollup, it turns every entry point to separate output chunks. It would be great if there was a possibility to have the same for CSS files with this plugin. As for now the plugin just generates one CSS file which contains all the styles. Extracting CSS into a single file makes tree-shaking no to work, in case I want to ship only critical styles in the bundle.
Bundle structure:
.
ββββcomponents
β ββββ Input
β β index.js
β ββββ Button
β β index.js
ββββfolder2
β index.js
β chunk.js
β styles.css
Bundle structure:
.
ββββcomponents
β ββββ Input
β β index.js
β β styles.css
β ββββ Button
β β index.js
β β styles.css
ββββfolder2
β index.js
β chunk.js
β styles.css
This is the rollup config that I have to reproduce the issue with this plugin:
rollupConfig = {
input: ['./src/components/Button/index.js', './src/components/Input/index.js'],
output: [
{
dir: lib,
format: 'cjs',
sourcemap: true,
exports: 'named'
},
],
plugins: [
postcss({
modules: true,
extract: true,
sourceMap: true,
minimize: true
})
]
}
Pay now to fund the work behind this issue.
Get updates on progress being made.
Maintainer is rewarded once the issue is completed.
You're funding impactful open source efforts
You want to contribute to this effort
You want to get funding like this too