webpack: 5.25.0 has broken my builds

Bug report

I have a Laravel app which uses blade.php for browser-side content, with some small <script> sections using JQuery. JQuery is part of the vendor.js chunk created by Webpack, via Laravel Mix

When build with 5.24.4, everything works as expected

What is the current behavior?

However, with 5.25, the bundles are created but when a page loads and attempts to use JQuery I get the dreaded…

ReferenceError: $ is not defined error in the browser console.

The only difference in the created bundles appears to be the new chunk loading code in manifest.js, and the __webpack_require__ section at the tail of each created file.

If the current behavior is a bug, please provide the steps to reproduce.

Probably difficult to provide this as it’s a large project - I will try and get a minimal example.

What is the expected behavior? “$” should be defined.

Other relevant information: webpack version: 5.25.0 Node.js version: this is a client-side issue. Operating System: Windows 10 Additional tools:

About this issue

  • Original URL
  • State: closed
  • Created 3 years ago
  • Reactions: 6
  • Comments: 17 (8 by maintainers)

Commits related to this issue

Most upvoted comments

Hi! I’m one of the people who works on Mix. I’d be happy to help where I can with this!

Ah that’s possible if you have a chunk with only css and no JS, due to splitChunks.

Yep this happens because we split CSS using splitChunks with a filename test + type: css/mini-extract + enforce: true

I thing bug on Laravel Mix side, as you can see no reports from other developers

Sorry, won’t fix, without example we can’t help you

Understood. Will try and make a minimal example.