Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error: Unexpected token ... #244

Closed
BryceLohr opened this issue Apr 11, 2022 · 3 comments · Fixed by #253
Closed

Error: Unexpected token ... #244

BryceLohr opened this issue Apr 11, 2022 · 3 comments · Fixed by #253

Comments

@BryceLohr
Copy link

It seems that Esprima is failing to parse code that uses the spread operator:

ERROR in ./node_modules/ajv/dist/core.js
Line 76: Unexpected token ...
Error: Line 76: Unexpected token ...
    at ErrorHandler.constructError (/workspaces/Tiller Scheduled Transactions/node_modules/esprima/dist/esprima.js:5012:22)
    at ErrorHandler.createError (/workspaces/Tiller Scheduled Transactions/node_modules/esprima/dist/esprima.js:5028:27)
    at Parser.unexpectedTokenError (/workspaces/Tiller Scheduled Transactions/node_modules/esprima/dist/esprima.js:1985:39)
    at Parser.throwUnexpectedToken (/workspaces/Tiller Scheduled Transactions/node_modules/esprima/dist/esprima.js:1995:21)
    at Parser.parseObjectPropertyKey (/workspaces/Tiller Scheduled Transactions/node_modules/esprima/dist/esprima.js:2499:33)
    at Parser.parseObjectProperty (/workspaces/Tiller Scheduled Transactions/node_modules/esprima/dist/esprima.js:2534:25)
    at Parser.parseObjectInitializer (/workspaces/Tiller Scheduled Transactions/node_modules/esprima/dist/esprima.js:2602:35)
    at Parser.inheritCoverGrammar (/workspaces/Tiller Scheduled Transactions/node_modules/esprima/dist/esprima.js:2285:37)
    at Parser.parsePrimaryExpression (/workspaces/Tiller Scheduled Transactions/node_modules/esprima/dist/esprima.js:2354:38)
    at Parser.inheritCoverGrammar (/workspaces/Tiller Scheduled Transactions/node_modules/esprima/dist/esprima.js:2285:37)
CodeGenerationError: Line 76: Unexpected token ...
    at /workspaces/Tiller Scheduled Transactions/node_modules/webpack/lib/Compilation.js:3330:18
    at /workspaces/Tiller Scheduled Transactions/node_modules/webpack/lib/Cache.js:93:5
    at Hook.eval [as callAsync] (eval at create (/workspaces/Tiller Scheduled Transactions/node_modules/tapable/lib/HookCodeFactory.js:33:10), <anonymous>:6:1)
    at Cache.get (/workspaces/Tiller Scheduled Transactions/node_modules/webpack/lib/Cache.js:75:18)
    at ItemCacheFacade.get (/workspaces/Tiller Scheduled Transactions/node_modules/webpack/lib/CacheFacade.js:111:15)
    at Compilation._codeGenerationModule (/workspaces/Tiller Scheduled Transactions/node_modules/webpack/lib/Compilation.js:3314:9)
    at /workspaces/Tiller Scheduled Transactions/node_modules/webpack/lib/Compilation.js:3221:11
    at arrayIterator (/workspaces/Tiller Scheduled Transactions/node_modules/neo-async/async.js:3467:9)
    at done (/workspaces/Tiller Scheduled Transactions/node_modules/neo-async/async.js:3527:9)
    at /workspaces/Tiller Scheduled Transactions/node_modules/webpack/lib/Compilation.js:3235:8
 @ ./node_modules/ajv/dist/ajv.js 4:15-32
 @ ./src/reconciliation/input/parse.ts 7:30-44
 @ ./src/reconciliation/index.ts 24:16-40
 @ ./src/main.ts 23:25-52

This started happening after I upgraded my project to use AJV 8.9.0. That version apparently uses the ellipsis/spread operator in the code it ships in its NPM package. Usages of the spread operator in my own code seem to be unaffected. Since then, I'm unable to build my project, because this parse error causes the webpack build to fail.

@fossamagna
Copy link
Owner

@BryceLohr I found same issue in esprima repo. I look like inactive it.
I will consider that migrate other parser.

@jogibear9988
Copy link

it's fixed in esprima next: https://github.com/node-projects/esprima-next

@BryceLohr
Copy link
Author

Great thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants