question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Bundle difference between 5.21.2 and 5.22.0+

See original GitHub issue

Bug 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.

bundle_5.73.0.txt

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?

bundle_5.9.0.txt

Other relevant information: webpack version: 5.73.0 Node.js version: 16.14 Operating System: MacOS Additional tools:

Issue Analytics

  • State:closed
  • Created a year ago
  • Comments:6 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
alexander-akaitcommented, Jun 8, 2022

trying to find the reason the bundle was coming out differently

Because we are trying to optimize our output so runtime can changed (also in early versions we have bugs, now they are fixed)

1reaction
alexander-akaitcommented, Jun 8, 2022

Unfortunately it is unsafe to rely on this, using eval you need to have return, but it is invalid when we build libraries, you need to rewrite tests. I recommend these steps

  1. Let’s set target: 'node' firstly, because we want to tests it and we will have node env (in some cases you can generate code for browser and it will be a problem)
  2. Then let’s rewrite:
async function evaluateGeneratedBundle() {
  return eval(`require("${getBundleFile()}")`);
}

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

Read more comments on GitHub >

github_iconTop Results From Across the Web

Webpack bundle behaviour different from 5.21.0 and 5.22.0
I am doing some upgrades to node a package which uses webpack. The package used to use webpack 5.9 for generating a small...
Read more >
perl5214delta - what is new for perl v5.21.4 - Perldoc Browser
This document describes differences between the 5.21.3 release and the 5.21.4 release. If you are upgrading from an earlier release such as 5.21.2,...
Read more >
perldelta - what is new for perl v5.22.0 - metacpan.org
This document describes differences between the 5.20.0 release and the 5.22.0 release. If you are upgrading from an earlier release such as 5.18.0, ......
Read more >
Azul Zulu Prime System Tools Issues Known in Previous ...
The following table lists known issues prior to the release of Azul Zulu Prime ... Before upgrading to ZST 5.22.0, comment out the...
Read more >
Amazon EMR archive of release notes
Release notes for all Amazon EMR releases are available below. ... This bucketing version difference between Hive 2 (EMR 5.x) and Hive 3...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found