-
-
Notifications
You must be signed in to change notification settings - Fork 9.3k
Description
Bug report
My assumption was that with webpack 5 CSS only entry points don't generate a .JS file or that optimization.removeEmptyChunks removes the empty files
What is the current behavior?
CSS only entry points generate empty .JS file in output folder.
If the current behavior is a bug, please provide the steps to reproduce.
Test repo:
https://github.com/martinherweg/webpack-css-chunks
Clone repo, npm install and npm run webpack
What is the expected behavior?
No empty .JS file in output folder
Other relevant information:
webpack version: 5.1.0
Node.js version: 10.16.3
Operating System: Mac OS Catalina
Additional note:
Behaviour was discussed with @evilebottnawi in #7300 he suggested it being a bug and creating a new issue.
Thanks for your work.
Notes (need fix too):
'use strict';
const path = require('path');
const MiniCssExtractPlugin = require('mini-css-extract-plugin');
module.exports = {
mode: 'development',
output: {
path: path.resolve('./dist'),
filename: '[name].css'
},
stats: {
children: true
},
name: 'scss',
entry: {
file1: path.resolve('./test1.scss'),
file2: path.resolve('./test2.scss')
},
module: {
rules: [
{
test: /(.)*\.scss$/,
use: [
MiniCssExtractPlugin.loader,
'css-loader',
'postcss-loader',
{
loader: 'sass-loader',
options: {
implementation: require('node-sass'),
}
}
]
}
]
},
plugins: [
new MiniCssExtractPlugin()
]
};Also not working because due Multiple assets emit different content to the same filename