Incompatible with Webpack 5 due to process dependency
See original GitHub issueDescribe the bug
Webpack 5 removes process
(see https://webpack.js.org/migrate/5/), effectively making it impossible to use this library since it has code like:
function asap(task) {
var rawTask;
if (freeTasks.length) {
rawTask = freeTasks.pop();
} else {
rawTask = new RawTask();
}
rawTask.task = task;
rawTask.domain = process.domain;
(0, _raw.rawAsap)(rawTask);
}
Reproduction
Use react-dnd 11.x and Webpack 4. Add the following to your Webpack config:
node: {
Buffer: false, // WEBPACK 5: Remove
process: false, // WEBPACK 5: Remove
},
Expected behavior
react-dnd should work in Webpack 5 builds
Issue Analytics
- State:
- Created 3 years ago
- Reactions:6
- Comments:7
Top Results From Across the Web
Upgrade to Webpack 5 failing - node.js - Stack Overflow
You need to fix scripts/start.js file. There is a line in this file: const compiler = createCompiler(webpack, config, appName, urls, ...
Read more >To v5 from v4 - webpack
This guide aims to help you migrating to webpack 5 when using webpack directly. If you are using a higher level tool to...
Read more >Incompatible with Webpack - Google Groups
The Knockout errors are due to a current (fixed) bug in knockout 3.2.0 with how they defined their module wrapper code. Forcing the...
Read more >[Fixed] NPM conflicting peer dependency error
compression-webpack-plugin@"9.0.1" from the root project npm ERR! npm ERR! Fix the upstream dependency conflict, or retry npm ERR! this command ...
Read more >How to Upgrade to React 17 and Webpack 5 Step by Step
3. Remove "Webpack" from dependencies and/or devDependencies in the package.json file in your project folder. 4. Run npm install or yarn, ...
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
I had the same issue but I was able to fix it by updating my webpack config file from
mainFields: ['main', 'browser']
tomainFields: ['browser', 'module', 'main']
, since@react-dnd/asap
exposes a browserified version via themodule
field in the package.json which doesn’t have any dependencies onprocess
. @nishadthajudeen @csvanI had the same issue but adding
module
tomainFields
unfortunately caused new issues with other packages in my project. Therefore I’ve added the followingresolve.alias
to my webpack config to solve this error:'@react-dnd/asap': '@react-dnd/asap/dist/esm/browser/asap.js'