SyntaxError: Unexpected token ... with v4+
See original GitHub issueLibrary Affected: workbox-webpack-plugin v4.3.1
Browser & Platform:
- npm v5.3.0
- node v8.0.0
- webpack v4.32.0
- webpack-cli v3.3.2
Issue or Feature Request Description: Im getting the following error when I run webpack (dev and prod) with the version 4.3.1.
options = { prototype: true, ...options };
^^^
SyntaxError: Unexpected token ...
After a downgrade to workbox-webpack-plugin v3.6.3 it works as expected. Is this a known issue?
Issue Analytics
- State:
- Created 4 years ago
- Comments:7 (2 by maintainers)
Top Results From Across the Web
SyntaxError: Unexpected token - JavaScript - MDN Web Docs
The JavaScript exceptions "unexpected token" occur when a specific language construct was expected, but something else was provided.
Read more >node.js - How to solve error "SyntaxError: Unexpected token '?'"
This will install and use the latest Node.js v14 (14.17.4). If u want to use a different version, change nvm install 14 to...
Read more >Problem on 4/9: SyntaxError: Unexpected token . | Codecademy
Problem on 4/9: SyntaxError: Unexpected token . I can't seem to figure out what's wrong here. I think it's pretty straightforward and simple...
Read more >SyntaxError: Unexpected token in JavaScript | bobbyhadz
The error message means that one character was expected, but another character was provided. This is commonly due to typos.
Read more >JavaScript SyntaxError - Unexpected token - GeeksforGeeks
This JavaScript exceptions unexpected token occur if a specific language construct was expected, but anything else is typed mistakenly.
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Ok, that’s strange. Node v8.0.0 throws the
SyntaxError: Unexpected token ...
Error, but Node v8.10.0 seems to work. I switched multiple times to make sure that’s the problem.Then I tried your experiment
> options = { prototype: true, ...options }
and that works with Node 8.10.0 AND Node 8.0.0. So it’s not the spread syntax (that works with both) but something else.In the end I’m fine with 8.10.0. Thank for your help!
Hmmm… you mention that you’re using node v8.0.0. Can you confirm that you’re actually on that version, and not something earlier?
As per https://node.green/#ES2015-syntax-spread-syntax-for-iterable-objects, that syntax should be supported going back to node v5.12.0.
I just tried the following experiment, and it worked fine: