Incompatibilty with webpack 5 because of missing polyfills
- Dominant language
- JavaScript
- Stars
- 1.5k
- Forks
- 228
- PR merge metrics
- No merged PRs in 30d
Description
Webpack 5 doesn't include polyfills for node.js
node-ip code uses os-browserify, and since it's brought as a dependency bundling fails with:
```
ERROR in ./node_modules/ip/lib/ip.js 3:11-24
Module not found: Error: Can't resolve 'os' in '/home/kkoukiou/repos/cockpit-machines/node_modules/ip/lib'
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: { "os": require.resolve("os-browserify/browser") }'
- install 'os-browserify'
If you don't want to include a polyfill, you can use an empty module like this:
resolve.fallback: { "os": false }
webpack compiled with 1 error
```
The workaround is fine, but would be nice that this would be solved on this module directly.
Contributor guide
No contributing guide indexed for this repository
Research direction
Start by reproducing the webpack 5 bundling failure and inspect the dependency path through node-ip into node_modules/ip/lib/ip.js, especially its use of os-browserify. Compare the module's behavior with and without the consumer-side fallback; done means webpack 5 can bundle the module without requiring that workaround.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript, node.js, webpack
- Domain
- build-system
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100