Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

326
Vistas
gruntjs - Uncaught SyntaxError: Identifier has already been declared

I am using grunt to uglify my Js code, but when I test my code in the browser I get:

Uncaught SyntaxError: Identifier has already been declared

Here is an example of the test I di: files:

testA.js-

export const myData = {
  a: "hello",
  b: "Me",
};

testB.js-

import { myData } from "./testA.js";

const doSomething =()=>{
    console.log(myData);
}

doSomething();

uglify file:

test.min.js-

const myData = { a: "hello", b: "Me" };
import { myData } from "./testA.js";
const doSomething = () => {
    console.log(myData);
  },
  myData = (doSomething(), { a: "hello", b: "Me" });
import { myData } from "./testA.js";
const doSomething = () => {
  console.log(myData);
};
doSomething();
export { myData, myData };

As you can see myData is exported twice but the error line starts at line 2. Is there a way to prevent grunt from creating duplicate identifiers to fix the problem?

about 4 years ago · Juan Pablo Isaza
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda