Webpack v5.x.x needs extra configuration than other webpack <5 projects
- Dominant language
- JavaScript
- Stars
- 7.8k
- Forks
- 983
- PR merge metrics
- No merged PRs in 30d
Description
**What version of this package are you using?**
9.9.3
**What operating system, Node.js, and npm version?**
- webpack v5.5.1
- node v12.9.1
- yarn 1.22.10
- simple-signal-client 3.0.0
**What happened?**
When receiving peer data, error is thrown:
```
_stream_readable.js:905 Uncaught (in promise) ReferenceError: process is not defined
at _stream_readable.js:905
at f.E.resume (_stream_readable.js:895)
at f.E.on (_stream_readable.js:813)
at App.js:25
at c (runtime.js:63)
at Generator._invoke (runtime.js:293)
at Generator.next (runtime.js:118)
at t (asyncToGenerator.js:3)
at s (asyncToGenerator.js:25)
```
**What did you expect to happen?**
In frontend (using signaling module `simple-signal-client`) the peer should receive data messages with no errors:
```js
peer.on('data', (data) => {
// ...
})
```
**Are you willing to submit a pull request to fix this bug?**
Not a pull request, but a solution. The problem is in webpack 5 now you need to add `process` explicitly.
To do so
1. Add module `process` to the project (Example: `yarn add --dev process`)
2. Add it as plugin in webpack config
```js
const webpack = require('webpack')
// ...
module.exports = {
// ...
plugins: [
// ...
new webpack.ProvidePlugin({
process: 'process/browser',
})
]
}
```
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.