2

I'm on a projet using LESS imported from JS bundled by webpack4.

My problem is that the project have its own design-system, with components using same components like "typography"

Example:
I have a button that import typo.less.
So all my chunks using that button will generate the result of typo.less.
How can I prevent this duplication? splitChunks seems not to operate here.

romuleald
  • 1,406
  • 16
  • 31
  • It's a pity you didn't show the webpack code. I understand that in one css file you get a duplicate of these styles? Therefore, I suggest using the postcss-loader and the cssnano plugin in the webpack. On this page you can see how it duplicates [cssnano](https://cssnano.co/playground/). Here's an example of using postcss-loader [webpack-boilerplate](https://github.com/tomik23/webpack-boilerplate/blob/master/config/webpack.prod.js#L106) – Grzegorz T. Jan 09 '20 at 12:05
  • Same issue here, it seems when specifying custom chunks, some imported css from chunk vendors gets duplicated into the custom chunk – Tofandel Jul 05 '20 at 20:46
  • We decided to move to CSS module to avoid conflict – romuleald Jul 06 '20 at 21:09

0 Answers0