grunt-terser Giving SyntaxError: "VARIABLE_NAME" is redeclared

231 Views Asked by At

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
0

There are 0 best solutions below