I am attempting to run r.js against our webapp, but am running into the following error:
Error: Error: The config in mainConfigFile /home/ubuntu/dev/proj/web/insight/js/main.js cannot be used because it cannot be evaluated correctly while running in the optimizer. Try only using a config that is also valid JSON, or do not use mainConfigFile and instead copy the config values needed into a build file or command line arguments given to the optimizer.
Source error from parsing: /home/ubuntu/dev/proj/web/insight/js/main.js: SyntaxError: Duplicate data property in object literal not allowed in strict mode
at /home/ubuntu/dev/proj/deploy/r.js:26725:27
I've exhausted searching google. I thought I could just plug in main.js as the mainConfigFile and it would take off, but apparently I have some other issue(s). Thanks in advance for any help.
Lösung
ResetPassView appears twice in your paths. That's an illegal JavaScript object. That's your error.
The error message: SyntaxError: Duplicate data property in object literal not allowed in strict mode was a gigantic clue that this was the problem. Cut and paste your config into an empty .js file, have node parse it, and bingo:
/tmp/foo.js:23
ResetPassView : 'views/ResetPassView',
^^^^^^^^^^^^^
SyntaxError: Duplicate data property in object literal not allowed in strict mode