Anidetrix / rollup-plugin-styles

🎨 Universal Rollup plugin for styles: PostCSS, Sass, Less, Stylus and more.
https://anidetrix.github.io/rollup-plugin-styles
MIT License
242 stars 43 forks source link

Unexpected code splitting, possible feature request #205

Closed JSteitz closed 9 months ago

JSteitz commented 2 years ago

Let us assume we want to process multiple modules:

{
  input: {
    module1: '...',
    module2: '...',
    etc:....
  }
}

and all modules share some code, the result would be:

module1.js  // export { x, y, z } from './shared.chunk.js'
module2.js  // import {x, y, z } from './shared.chunk.js'
shared.chunk.js

this is all right for js, but now this happens with css with shared styles:

module2.css
shared.chunk.css <-- this contains also module1.css

I know that this happens because module1.js only re-exports the functions and the main code is in the chunk. Should the css not mimic the same behavior? For example with an @import statement. If the current behavior is intended, could we get this as an option?