amd-optimize icon indicating copy to clipboard operation
amd-optimize copied to clipboard

Error on arrow function

Open thany opened this issue 9 years ago • 2 comments

When I have an arrow function anywhere in my modules, it reports a syntax error SyntaxError: Unexpected token and stops executing.

Is it using some sort of separate (third party) javascript parser, instead of just node? If it doesn't even support arrow function, I'm afraid it doesn't support any of the new ES6 syntax sugar ☹

I'm using this module from within Gulp. Latest up-to-date everything 😎

thany avatar Aug 19 '16 10:08 thany

Here's a full error output:

events.js:160
      throw er; // Unhandled 'error' event
      ^

SyntaxError: Unexpected token (12:46) in D:\Klanten\qsdashboard\source\js\modules\common\click-outside.js
    at raise (D:\Klanten\qsdashboard\node_modules\acorn\acorn.js:319:15)
    at unexpected (D:\Klanten\qsdashboard\node_modules\acorn\acorn.js:1311:5)
    at parseExprAtom (D:\Klanten\qsdashboard\node_modules\acorn\acorn.js:2070:7)
    at parseExprSubscripts (D:\Klanten\qsdashboard\node_modules\acorn\acorn.js:1933:28)
    at parseMaybeUnary (D:\Klanten\qsdashboard\node_modules\acorn\acorn.js:1917:16)
    at parseExprOps (D:\Klanten\qsdashboard\node_modules\acorn\acorn.js:1875:24)
    at parseMaybeConditional (D:\Klanten\qsdashboard\node_modules\acorn\acorn.js:1860:16)
    at parseMaybeAssign (D:\Klanten\qsdashboard\node_modules\acorn\acorn.js:1844:16)
    at parseMaybeAssign (D:\Klanten\qsdashboard\node_modules\acorn\acorn.js:1851:20)
    at parseExpression (D:\Klanten\qsdashboard\node_modules\acorn\acorn.js:1830:16)

Looking at the source, this module uses acorn, and that's where the error is being thrown. So my suspiction was correct - why not use node to parse javascript instead some (apparantly not very well written) third party parser?

thany avatar Aug 19 '16 10:08 thany

Any news on this ? I'm working on a project that use this old build chain and I'm stuck to include some new parts.

Baart avatar Jan 08 '18 13:01 Baart