-
-
Notifications
You must be signed in to change notification settings - Fork 596
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Terser is executed twice, when explicit configured as minimizer #1564
Comments
Thanks for your report. It would be great if you reduce your issue to a small reproducible example. Best put this example into a github repository together with instructions how to get to the problem. |
Hello @sokra, thanks for your response. Excuse me for not posting a link to a github repro. I need to setup a environment for it first (Still using TFS). You can download below files here. All in the same directory: package.json {
"name": "repro",
"version": "2020.1.0",
"private": true,
"dependencies": {
"jquery": "^3.4.1"
},
"devDependencies": {
"terser-webpack-plugin": "^3.0.1",
"webpack": "^5.0.0-beta.16",
"webpack-cli": "^4.0.0-beta.8"
},
"scripts": {
"build:production": "webpack --progress --mode production --config ./webpack.config.js"
}
} webpack.config.js const path = require('path');
const dirname = __dirname;
const TerserPlugin = require('terser-webpack-plugin');
module.exports = () => {
const config = {
entry: './main.js',
output: {
path: path.join(dirname, 'dist'),
filename: '[name].js',
ecmaVersion: 5
},
optimization: {
minimizer:
[
new TerserPlugin({
sourceMap: false,
extractComments: {
filename: (fileData) => {
return `${fileData.filename}.OTHER.LICENSE.txt${fileData.query}`;
}
}
})
]
}
}
return config;
}; main.js import $ from 'jquery';
window.$ = $; Execute:
Current Output: Expected Output: only Just to be clear, where I am coming from: My intention is not to change the
Using |
Bug in webpack-cli |
/cc @webpack/cli-team high priority, |
@evilebottnawi is it because we've specified devtool in production config which is used when mode production/development?
|
@anshumanv we should not merge this config in production mode, it is a whole invalid logic, just set |
webpack provides default configuration for a mode out of box |
Will fix |
Fixed #1565 |
Bug report
What is the current behavior?
It seems the default terser is executed, even if configured a custom one
*.LICENSE.txt
, and custom*.OTHER.LICENSE.txt
is createdIf the current behavior is a bug, please provide the steps to reproduce.
Have the following optimization:
What is the expected behavior?
Terser is not executed twice.
Other relevant information:
webpack version:
^5.0.0-beta.16
terser version:
^3.0.1
Node.js version:
12.16.3
Operating System:
Windows 10
The text was updated successfully, but these errors were encountered: