-
Notifications
You must be signed in to change notification settings - Fork 28
Suport for webpack 5.66.0 #42
Comments
Npm i url |
@Kroy665 did install url fix your issue? |
Hello, I had the same issue and in order to make it work I had to do the following:
{
...
plugins: [
...
new webpack.ProvidePlugin({ process: 'process/browser', Buffer: ['buffer', 'Buffer'] }),
....
]
} to your |
I've fixed this with a less intrusive way (without ejecting), by adding
FixImport.ts: import process from 'process'
import buffer from 'buffer'
(window as any).Buffer = buffer.Buffer;
(window as any).process = process;
export {}; App.tsx
|
Thanks for the fix. The client state is null The broker is fully working, as I was previously using plain mqtt package without no issues. Tested also with public mqtt brokers, same results. If someone has an idea ? |
I am having the same issue after resolving compilation issues with this workaround: https://alchemy.com/blog/how-to-polyfill-node-core-modules-in-webpack-5 |
My error is:
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:
- add a fallback 'resolve.fallback: { "url": require.resolve("url/") }'
- install 'url'
If you don't want to include a polyfill, you can use an empty module like this:
resolve.fallback: { "url": false }
package.json :
{
"name": "mqtt-app",
"version": "0.1.0",
"private": true,
"dependencies": {
"@testing-library/jest-dom": "^5.16.1",
"@testing-library/react": "^12.1.2",
"@testing-library/user-event": "^13.5.0",
"mqtt-react-hooks": "^2.0.3",
"react": "^17.0.2",
"react-dom": "^17.0.2",
"react-scripts": "5.0.0",
"web-vitals": "^2.1.3"
},
"scripts": {
"start": "react-scripts start",
"build": "react-scripts build",
"test": "react-scripts test",
"eject": "react-scripts eject"
},
"eslintConfig": {
"extends": [
"react-app",
"react-app/jest"
]
},
"browserslist": {
"production": [
">0.2%",
"not dead",
"not op_mini all"
],
"development": [
"last 1 chrome version",
"last 1 firefox version",
"last 1 safari version"
]
}
}
The text was updated successfully, but these errors were encountered: