theKashey / rewiremock

The right way to mock dependencies in Node.js or webpack environment.
MIT License
492 stars 30 forks source link

Configuration for Mocha/webpack5 #135

Open cardosoj-ppb opened 2 years ago

cardosoj-ppb commented 2 years ago

Hi, In our applications we have been using this plugin for a while. Recently. we needed to bump our webpack version to webpack5.

When running our tests we get an error:

/***/if(typeof __webpack_require__!=='undefined') {
     ^^

SyntaxError: Unexpected token 'if'

This seems like an incompatibility with webpack5.

Currently we are using Node 14 (nvm use 14) withe that following package versions:

"mocha": "10.0.0",
"rewiremock": "3.14.3",
"webpack": "5.46.0"

Thanks

theKashey commented 2 years ago

Duplicate of https://github.com/theKashey/rewiremock/issues/134