jaredpalmer / razzle

✨ Create server-rendered universal JavaScript applications with no configuration
https://razzlejs.org
MIT License
11.11k stars 867 forks source link

How to use webpack 5 with Razzle 4 #1926

Closed debchy closed 10 months ago

debchy commented 10 months ago

with bellow devDependency

"devDependencies": { "babel-preset-razzle": "^4.2.18", "html-webpack-plugin": "^4.5.2", "mini-css-extract-plugin": "^0.9.0", "razzle": "^4.2.18", "razzle-dev-utils": "^4.2.18", "webpack": "^5.89.0", "webpack-dev-server": "^4.15.1" }

I am getting bellow errors

ERROR in ./node_modules/razzle-dev-utils/webpackHotDevClientV4.js 18:10-24 Module not found: Error: Can't resolve 'url' in 'D:\RND\razzle\razzle-test\node_modules\razzle-dev-utils'

BREAKING CHANGE: webpack < 5 used to include polyfills for node.js core modules by default. This is no longer the case. Verify if you need this module and configure a polyfill for it.

If you want to include a polyfill, you need to:

debchy commented 10 months ago

I have resolved this issue. now Razzle 4 is working with webpack 5 for the bellow dev dependencies

  "devDependencies": {
    "babel-preset-razzle": "^4.2.18",
    "html-webpack-plugin": "^5.6.0",
    "razzle": "^4.2.18",
    "razzle-dev-utils": "^4.2.18",
    "webpack": "^5.89.0",
    "webpack-dev-server": "^3.11.3"
  }