francesco
francesco

Reputation: 329

(webpack 4) + sass-loader + mini-css-extract-plugin , ignore sass dependencies, generated css is missing in the output dir

I've added an issue in github ( but yet I'm not sure which plugin this problem belong ) but maybe someone have found a workaround/different approach for this

I've also created a sample project so you can play&try in 1 minute

the problem seems that from the javascript entrypoint the import load correctly css files and sass files, but the sass files, once converted doesn't get placed in output dir ( by mini-css-extract-plugin ) while the css does..

(also note that extract-text plugin seems doesn't have this problem )

the readme of the sample-project also contain more detailed instruction on how to run it and output https://github.com/fvigotti/webpack-problem-scss

I don't want to add all my sass as entrypoint ( this solution seems to work but this is not the way it should work and it's also a code smell because then I have to mantain dependencies between entrypoints and styles in the webpack configuration.. )

someone have a solution or a working example ?

thank you, Francesco

Upvotes: 2

Views: 1372

Answers (1)

francesco
francesco

Reputation: 329

I've found the problem, In package.json ( which I've inherited from another project ) this : "sideEffects": [ "*.css" ], caused this issue, I don't know why if affected the only the scss and not the css, even when they are bot handled by same module ( and same rule ) only the css ( maybe is a bug, but minor in this case ) is exported and not the sass , anyway removing this from my sample project , now works :) I'll add a commit to my project with a working version so it can still be referenced as working example

Upvotes: 1

Related Questions