Webpack 5.45.0 error "Module parse failed: Unexpected token (2:7)" Webpack 5.46.0 repeats "[HMR] Nothing hot updated."
See original GitHub issue🐛 Bug report
Current Behavior
Webpack 5.45.0 and 5.46.0 doesn’t work.
I read #1662 - this is different - Webpack 5.44.0 works great for me with Razzle.js.
Expected behavior
Demo razzle-app works with Webpack 5.46.0.
Reproducible example
Webpack 4.44.1:
yarn create razzle-app razzle-nothing-hot-updated
cd razzle-nothing-hot-updated
yarn start
Works great!
Update to Webpack 5.44.0:
diff --git a/package.json b/package.json
index 4eb0002..566aaf9 100644
--- a/package.json
+++ b/package.json
@@ -21,7 +21,7 @@
"mini-css-extract-plugin": "^0.9.0",
"razzle": "^4.0.5",
"razzle-dev-utils": "^4.0.5",
- "webpack": "^4.44.1",
+ "webpack": "5.44.0",
"webpack-dev-server": "^3.11.2"
}
}
yarn install
yarn start
Works great!
Update to Webpack 5.45.0.
Browser reports error:
Module parse failed: Unexpected token (2:7)
You may need an appropriate loader to handle this file type, currently no loaders are configured to process this file. See https://webpack.js.org/concepts#loaders
| import _typeof from "@babel/runtime/helpers/typeof";
> import assertThisInitialized from "./assertThisInitialized.js";
| export default function _possibleConstructorReturn(self, call) {
| if (call && (_typeof(call) === "object" || typeof call === "function")) {
Update to Webpack 5.46.0.
$ yarn start
yarn run v1.22.5
$ razzle start
If you have issues with css make sure postcss resolves to v8.2.4.
See: https://razzlejs.org/getting-started#common-issues
CssMinimizerPlugin currently uses clean-css,
we will switch to cssnano once it supports postcss v8.2.4.
WAIT Compiling...
√ Client
√ Server
Compiled successfully in 198.55ms
sswp> Handling Hot Module Reloading
✅ Server-side HMR Enabled!
> Started on port 3000
[HMR] Nothing hot updated.
[HMR] Nothing hot updated.
[HMR] Nothing hot updated.
[HMR] Nothing hot updated.
[HMR] Nothing hot updated.
[HMR] Nothing hot updated.
[HMR] Nothing hot updated.
repeated forever. Server doesn’t respond on localhost:3000
Additional context
Maybe a Webpack bug?
Your environment
Software | Version(s) |
---|---|
Razzle | 4.0.5 |
Razzle Plugins | none |
Node | 16.5.0 |
Browser | Chrome |
npm/Yarn | yarn 1.22.5 |
Operating System | Windows 10 |
TypeScript | No |
React | 17.0.2 |
Issue Analytics
- State:
- Created 2 years ago
- Reactions:2
- Comments:9 (3 by maintainers)
Top Results From Across the Web
Webpack 4: Module parse failed: Unexpected token
During my builds, webpack is giving me this error: ERROR in ./client/components/App/index.tsx 15:9 Module parse failed: Unexpected token ...
Read more >webpack Tutorial: How to Set Up webpack 5 From Scratch
webpack is a module bundler. It packs all your code neatly for the browser. It allows you to write the latest JavaScript with...
Read more >Hot Module Replacement - webpack
Hot Module Replacement (HMR) exchanges, adds, or removes modules while an application is running, without a full reload. This can significantly speed up ......
Read more >The best webpack configurations for React applications
If you've struggled to configure webpack for your React app, look no further. We cover both generic and specific config needs.
Read more >Webpack 5 Full Project Setup - YouTube
We are going for the big haul on this one. We'll start out creating a new Webpack 5 project, putting it on Github,...
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
Hi I can confirm that with
webpack@5.48.0
the infinite loop is gone, but the message in terminal remainsBut, despite the message, the modules have been replaced and so far everything works as expected
Best regards
Fixed https://github.com/webpack/webpack/releases/tag/v5.48.0, please update