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.

support webpack@5

See original GitHub issue

Issue description

Technical info

  • Webpack Bundle Analyzer version: latest
  • Webpack version: next (5)
  • Node.js version: 10.13.0
  • npm/yarn version: npm 6.13.4
  • OS: Linux Ubuntu

Debug info

Support webpack@5 (will be great have CI and fix test to ensure all works as expected)


Additional comment by @valscion in https://github.com/webpack-contrib/webpack-bundle-analyzer/issues/327#issuecomment-729614325:

This one for example has been open almost a year, and the webpack v5 stable release was over a month ago.

Do note that webpack-bundle-analyzer does work with webpack version 5. There is some combination of options which breaks, but not all of webpack 5.

We even test that this package works with webpack v5: https://github.com/webpack-contrib/webpack-bundle-analyzer/tree/master/test/webpack-versions/5.4.0

So this is only an edge case that is broken, not the entire support for webpack 5.

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Reactions:5
  • Comments:17 (12 by maintainers)

github_iconTop GitHub Comments

8reactions
Linkskucommented, Jul 28, 2020

After upgrading to webpack@^5.0.0-beta.22, webpack-bundle-analyzer just shows a single main.js, while other packages such as webpack-visualizer are able to display my files correctly. The content of stats.json looks normal.

Interestingly, after I added back Webpack 4 with yarn add webpack4@npm:webpack@latest, using webpack4 to generate stats.json produces the same issue of a single main.js. If I completely remove Webpack 5, then webpack-bundle-analyzer works again.

Any ideas on how to build using Webpack 5 normally, but use Webpack 4 just for webpack-bundle-analyzer?

3reactions
sokracommented, Dec 18, 2019

webpack has a different output AST so the parser need to be adjusted. It also gets a little bit more challenging as more variations are possible:

/******/ (() => { // webpackBootstrap
/******/ 	var __webpack_modules__ = ([
MODULES HERE
/******/ 	]);
/******/ (() => { // webpackBootstrap
/******/ 	"use strict";
/******/ 	var __webpack_modules__ = ([
MODULES HERE
/******/ 	]);
(() => {
	var e = [
MODULES HERE
        ], r = {};
	function t(o) {
		if (r[o]) return r[o].exports;
		var n = (r[o] = { exports: {} });
		return e[o](n, n.exports, t), n.exports;
	}

Arrow functions may also be normal functions when output.ecmaVersion: 5.

Arrays might be objects too, as with webpack 4.

There might also be one entry module inlined into the runtime code, which is very difficult to identify in production mode.

Read more comments on GitHub >

github_iconTop Results From Across the Web

To v5 from v4 - webpack
This guide aims to help you migrating to webpack 5 when using webpack directly. ... since latest version might only support webpack 5...
Read more >
facebook/create-react-app - Webpack 5 support overview
Overview of tasks needed for updating CRA to Webpack 5 - Some of the work will support both Webpack 4 + 5 but...
Read more >
Webpack 5 Adoption - Next.js
Improved Long Term Caching of Assets: Deterministic code output that is less likely to change between builds; Improved Tree Shaking; Support for assets...
Read more >
Webpack - npm
Webpack supports ES2015+, CommonJS and AMD modules out of the box. It performs clever static analysis on the AST of your code. It...
Read more >
Upgrading Webpack 4 → 5 | Square Corner Blog
We upgraded to v3.0.0 for Webpack 5 support. - const ManifestPlugin = require('webpack-manifest-plugin') + const { WebpackManifestPlugin } ...
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