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

211
Vistas
Grunt is failing to build on some valid js syntax

I'm working on a legacy project with grunt. I believe from the package.json that the version is 0.4.5 but I don't do too much front end work so may have made a mistake there.

Essentially I'm trying to build a JSON object from JavaScript that has some dynamic key value pairs.

I'm doing this

var params = {
    [localObject.propertyValue]: localObject.otherPropertyValue,
    "dateRange": {
        "start": localObject.startPropertyValue,
        "end": localObject.endPropertyValue
    }
}

This works perfectly. I post it off to the end point and get the result I want and I've been playing with it all afternoon using

grunt --profile=devServer

However when I do a grunt build I get a failure. It is around the computed property name - [localObject.propertyValue]. If I leave this out it builds without a problem.

This is the error. I'm struggling to think if a different way to dynamically add the key and I know no one will want me to update grunt. I just wondered if anyone could help ?

JS_Parse_Error {   message: 'Unexpected token: name
(scheduleSearchController)',   filename:
'../../.tmp/concat/js/app.js',   line: 34463,   col: 6,   pos:
1254651,   stack:    'Error\n    at new JS_Parse_Error
(/grunt-contrib-uglify/node_modules/uglify-js/lib/parse.js:196:18)\n  
at js_error
(/node_modules/grunt-contrib-uglify/node_modules/uglify-js/lib/parse.js:204:11)\n
at croak
(/node_modules/grunt-contrib-uglify/node_modules/uglify-js/lib/parse.js:674:9)\n
at token_error
(/node_modules/grunt-contrib-uglify/node_modules/uglify-js/lib/parse.js:682:9)\n
at unexpected
(/node_modules/grunt-contrib-uglify/node_modules/uglify-js/lib/parse.js:688:9)\n
at as_property_name
(/node_modules/grunt-contrib-uglify/node_modules/uglify-js/lib/parse.js:1276:13)\n
at
/node_modules/grunt-contrib-uglify/node_modules/uglify-js/lib/parse.js:1230:24\n
at
/node_modules/grunt-contrib-uglify/node_modules/uglify-js/lib/parse.js:721:24\n
at expr_atom
(/node_modules/grunt-contrib-uglify/node_modules/uglify-js/lib/parse.js:1181:35)\n
at maybe_unary
(/node_modules/grunt-contrib-uglify/node_modules/uglify-js/lib/parse.js:1357:19)'
}
>> Uglifying source .tmp/concat/js/app.js failed. Warning: Uglification failed.
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