Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Webpack 5: how to allow setImmediate?

Tags:

webpack

How to allow node' setImmediate in Webpack 5? The doc says I can set this property to true in the node object, but the build crashes, claiming that the configuration object that does not match the API schema.

My code is:

  node: {
      global: true,
      __filename: false,
      __dirname: false
     // setImmediate: true (here commented, because it crashes otherwise)
    },
like image 739
DoneDeal0 Avatar asked Oct 31 '25 09:10

DoneDeal0


1 Answers

I have same issue and I have solved with below steps

Please check your node_modules, and just install setimmediate from https://github.com/YuzuJS/setImmediate if you don't have this module.

Next step, just import "setimmediate" or require("setimmediate") on top of your main js file.

like image 127
Forte Zhuo Avatar answered Nov 03 '25 01:11

Forte Zhuo



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!