-
Notifications
You must be signed in to change notification settings - Fork 673
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
Unexpected token ... #1003
Comments
This looks to be an issue with Esprima: last release for it was 4.0.1 (2 years ago), and it seems like it is not keeping up with the new standards: jquery/esprima#1949 In that Esprima issue, another project switched away from Esprima to espree. I just tried dropping in espree into r.js, but some of the r.js tests fail (4 failing tests), so it is not a drop in replacement. I don't have time to look more into it now. So for now the workaround is to avoid object spread in the source code. |
As a follow up, is there an easy way to pass in espima options with the config or cli? Maybe a {tolerant: true} option. |
Looking back in the code, there currently is not a way to provide options to pass to Esprima. |
Looking at Esprima, it seems that the master branch is being updated fairly regularly (but no releases, as you mentioned). I've tried pulling in a build from the master branch (along with a couple pending PRs related to ES2019 syntaxes), and adding to build/jslib/esprima.js This seems to work fine (one test fails, but it also fails with the current r.js... It seems to be an outdated test file..?). This would add support for:
If you like, I can open a PR for this change? |
I would love to see an update to the latest Esprima master. Is there something I can help with directly, or something I can "encourage" through a bounty? |
Do you mind creating a PR with all your changes? I only got started with fixing the test case, but you have already done the work integrating Esprima master. |
@chrswk - apologies, I hadn't seen the reply. I'll take a look at opening a PR here when I get a chance. I did the upgrade of Esprima-to-master in my fork if you want to check that out: https://github.com/ejdaly/r.js (I seem to have made 2 small commits after that, so you may / may not want those commits...) |
Aside: there may be some momentum starting to get a new Esprima release, which would be fantastic... |
@ejdaly No worries. I've been using your version/fork for a couple of weeks now, so thanks again for your efforts! |
Still optional chaining is failing r.js, web-packing. When this will get resolved? |
This causes problems with a lot of new JS functionality like optional chaining, spread, etc. I recommend requirejs upgrade to espira-next |
The parser bundled to r.js is too old. You'll need to upgrade it. See #998. |
// blabla.js
const a = {a: 1, b: 2};
const b = {...a, c: 3};
node r.js -o blabla.js
output error: Error: Line 2: Unexpected token ...
The text was updated successfully, but these errors were encountered: