Module parse failed: The keyword 'yield' is reserved
See original GitHub issueWhat version of Next.js are you using?
12.0.4
What version of Node.js are you using?
16.13.0
What browser are you using?
NA
What operating system are you using?
macOS
How are you deploying your application?
NA
Describe the Bug
npm run build
fails with the following error:
Module parse failed: The keyword 'yield' is reserved (453:107)
File was processed with these loaders:
* ./node_modules/next/dist/build/webpack/loaders/next-swc-loader.js
You may need an additional loader to handle the result of these loaders.
when looked closely at the code, there is an await call which is converted to as yield throwing an error.
Not sure why this is throwing as an error.
Expected Behavior
Build should pass.
To Reproduce
Write a function with async/await.
Run npm run build
.
Issue Analytics
- State:
- Created 2 years ago
- Reactions:16
- Comments:14 (7 by maintainers)
Top Results From Across the Web
"The keyword yield is reserved" eslint error - Stack Overflow
I'm attempting to use Webpack 1.13.12 and eslint 3.11.0 and eslint-plugin-promise 3.4.0. I'm trying to use the answer in this question to get ......
Read more >SyntaxError: The keyword 'yield' is reserved. Console Error in ...
I'm trying Nakama, a great game server for realtime multiplayer, and most of their Javascript client example code includes the use of ...
Read more >Javascript – “The keyword yield is reserved” eslint error
When I attempt to lint this, eslint complains that The keyword 'yield' is reserved. I've tried setting require-yield to 0 in my ....
Read more >the keyword 'yield is reserved react native - Code Grepper
The keyword 'yield' is reserved ... // try to add `await` to function if not there already.
Read more >ES6 doesn't need opt-in - ES Discuss
For example, if let as a keyword breaks the web, then in global code we treat it as an ... yield reserved in...
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
Can you try again? There was a publishing issue with npm
+1 Seeing the same issue. This code uses an await and is replaced by yield when compiled. Issue presented going from next.js 12.0.1 -> 12.0.4
Here’s the code before it’s compiled