Bug Description
When running with terser-webpack-plugin 5.3.15, a generated file that should be empty is no longer empty.
Link to Minimal Reproduction and step to reproduce
- In an empty directory, run
npm add webpack webpack-cli terser-webpack-plugin
- Create the following
webpack.config.js:
module.exports = {
mode: 'production',
entry: './src/index.js',
};
- Create the following file at
src/index.js:
- Run
npm exec webpack
- Examine the generated
dist/main.js file.
Expected Behavior
The file dist/main.js is 0 bytes.
Actual Behavior
The file dist.main.js has the following content:
/******/ (() => { // webpackBootstrap
// This module is empty.
/******/ })()
Environment
System:
OS: Linux 6.17 Debian GNU/Linux forky/sid
CPU: (16) x64 AMD Ryzen 7 7840U w/ Radeon 780M Graphics
Memory: 23.73 GB / 30.66 GB
Binaries:
Node: 22.21.0 - /usr/bin/node
Yarn: 1.22.22 - /usr/local/bin/yarn
npm: 10.9.4 - /usr/bin/npm
pnpm: 10.25.0 - /usr/local/bin/pnpm
Browsers:
Firefox: 145.0.1
Firefox Developer Edition: 145.0.1
Packages:
terser-webpack-plugin: ^5.3.15 => 5.3.15
webpack: ^5.103.0 => 5.103.0
webpack-cli: ^6.0.1 => 6.0.1
Is this a regression?
Yes (please specify version below)
Last Working Version
5.3.14
Additional Context
In production, what we're mostly seeing is
/******/ (() => { // webpackBootstrap
/******/ "use strict";
// extracted by mini-css-extract-plugin
/******/ })()
;
for modules where https://www.npmjs.com/package/mini-css-extract-plugin has extracted the CSS and there is no JS code in the module. With earlier versions of terser-webpack-plugin these were empty files.
Bug Description
When running with
terser-webpack-plugin5.3.15, a generated file that should be empty is no longer empty.Link to Minimal Reproduction and step to reproduce
npm add webpack webpack-cli terser-webpack-pluginwebpack.config.js:src/index.js:// This module is empty.npm exec webpackdist/main.jsfile.Expected Behavior
The file
dist/main.jsis 0 bytes.Actual Behavior
The file
dist.main.jshas the following content:Environment
System: OS: Linux 6.17 Debian GNU/Linux forky/sid CPU: (16) x64 AMD Ryzen 7 7840U w/ Radeon 780M Graphics Memory: 23.73 GB / 30.66 GB Binaries: Node: 22.21.0 - /usr/bin/node Yarn: 1.22.22 - /usr/local/bin/yarn npm: 10.9.4 - /usr/bin/npm pnpm: 10.25.0 - /usr/local/bin/pnpm Browsers: Firefox: 145.0.1 Firefox Developer Edition: 145.0.1 Packages: terser-webpack-plugin: ^5.3.15 => 5.3.15 webpack: ^5.103.0 => 5.103.0 webpack-cli: ^6.0.1 => 6.0.1Is this a regression?
Yes (please specify version below)
Last Working Version
5.3.14
Additional Context
In production, what we're mostly seeing is
for modules where https://www.npmjs.com/package/mini-css-extract-plugin has extracted the CSS and there is no JS code in the module. With earlier versions of
terser-webpack-pluginthese were empty files.