parse error using esprima for file while optimizing js files with r.js

florence picture florence · Nov 1, 2013 · Viewed 9.4k times · Source

I am optimizing several js files into one using r.js. It works fine before. Recently,I modified some js code, add the code as:

var x = 08;

then it shows

ERROR:parse error using esprima for file D://webroot/js/a.js

ERROR:line 45: Unexpected token ILLEGAL.

Line 45 is where I add var x = 08, and 09 will show error too. It seemed that numbers begining with 0 meanwhile containing 8 or 9 is illegal. Maybe they were treated as bese 8 number .. ?

How can I let r.js ignore this point and still optimizie js files?

Answer

Pascal picture Pascal · Sep 23, 2014

i had the same problem

Turn out that it was just a double comma while requiring files. Ex

define([
 'file1',
 'file2',
 'file3',,
 'file4'

Hope this helps