grunt-terser Giving SyntaxError: “VARIABLE_NAME” is redeclared

99封情书 提交于 2021-01-28 05:44:31

问题


I'm using grunt-terser to minify my es6 files. I have two files.

  1. file-1.js
  2. 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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!