问题
I'm using grunt-terser to minify my es6 files.
I have two files.
- file-1.js
- file-2.js
In both files I have required a module with same variable name like this:
const VARIABLE_NAME = require('MODULE_NAME');
Here is my grunt-terser task:
terser: {
main: {
options: { compress: true, toplevel: true },
files: {
'./dist/app.js':
['file-1.js', 'file-2.js']
}
}
}
When I run
npx grunt terser
I get the following error:
Running "terser:main" (terser) task
>> SyntaxError: "VARIABLE_NAME" is redeclared
来源:https://stackoverflow.com/questions/63629629/grunt-terser-giving-syntaxerror-variable-name-is-redeclared