Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

199
Views
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
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!