Bundle difference between 5.21.2 and 5.22.0+
See original GitHub issueBug report
I have noticed there’s a difference in the format of the bundle between 5.21.2 and 5.22.0+.
I am making a change to a small loader which today is using 5.9.0 and since I moved to 5.73.0 all my tests have stopped working. The resulting bundle can’t be evaluated.
What is the current behavior?
The bundle.js returned using this configuration does not include anymore, at the top, the module.exports = which prevent my evaluation function from working.
If the current behavior is a bug, please provide the steps to reproduce.
You can reproduce it cloning my repo, on master branch, with webpack 5.9.0 everything works. On feat/deps-bump with webpack 5.73.0 it does not work. Doing few tests, I discovered the behavior changes from 5.21.2 and 5.22.0.
What is the expected behavior?
Other relevant information: webpack version: 5.73.0 Node.js version: 16.14 Operating System: MacOS Additional tools:
Issue Analytics
- State:
- Created a year ago
- Comments:6 (4 by maintainers)

Top Related StackOverflow Question
Because we are trying to optimize our output so runtime can changed (also in early versions we have bugs, now they are fixed)
Unfortunately it is unsafe to rely on this, using
evalyou need to havereturn, but it is invalid when we build libraries, you need to rewrite tests. I recommend these stepstarget: 'node'firstly, because we want to tests it and we will havenodeenv (in some cases you can generate code for browser and it will be a problem)It is even faster, you don’t need to read a file 3. I recommend to generate tmp file (https://github.com/raszi/node-tmp)/unique file name for each output, otherwile you can have racing here and tests will not be stable