When building SASS/SCSS files directly with webpack 4 in combination with the MiniCssExtractPlugin 2 files are emitted: the expected CSS output but also a JavaScript file.
I use the CSS files as entry points (not importing them from JS source). I'm not sure what part of the chain is responsible for this behavior because especially for SASS quite some loaders must be used. In order to reproduce the problem, I created this repo: https://github.com/jneuendorf/webpack4-mini-css-extract-plugin
According to some other stackoverflow questions one should import the CSS file from within JavaScript but these answers may not be up to date anymore. See
- Webpack generates js files with css / scss files
- Webpack bundle generates additional JS file along with CSS file
- Webpack building both css and js files
Is this still the recommended or is there also a clean webpack-style version to solve the problem for CSS entry points?