Problem Description
When using rollup-plugin-postcss with CSS modules, the plugin generates duplicate CSS content in the output bundle, leading to unnecessary bundle size increase. This occurs because the same CSS content is stored twice:
- Once in the CSS variable (
var ${cssVariableName})
- Again in the stylesheet export (
export var stylesheet)
This duplication directly impacts the final bundle size, which is especially problematic for production builds where bundle size optimization is critical.
Current Behavior (Causing Bundle Bloat)
var css_248z = ".class { color: red; }";
var stylesheet = ".class { color: red; }";
// inject code
export { css_248z as default, stylesheet };
//# sourceMappingURL=...
Expected Behavior (Optimized)
var css_248z = ".class { color: red; }";
var stylesheet = css_248z;
// inject code
export { css_248z as default, stylesheet };
//# sourceMappingURL=...
Environment
rollup-plugin-postcss version: 4.0.2
Problem Description
When using
rollup-plugin-postcsswith CSS modules, the plugin generates duplicate CSS content in the output bundle, leading to unnecessary bundle size increase. This occurs because the same CSS content is stored twice:var ${cssVariableName})export var stylesheet)This duplication directly impacts the final bundle size, which is especially problematic for production builds where bundle size optimization is critical.
Current Behavior (Causing Bundle Bloat)
Expected Behavior (Optimized)
Environment
rollup-plugin-postcssversion: 4.0.2