Simplify your stack and build anything. Or everything.
Build tomorrow’s web with a modern solution you truly own.
Code-based nature means you can build on top of it to power anything.
It’s time to take back your content infrastructure.

Webpack bundle analyzer plugin doesn't start

default discord avatar
ser_franklast year

For unknown reasons the browsers sometimes loads a payload bundle of 38mb.


I want to analyze this with webpack-bundle-analyzer but nothing happens if I add this as a plugin. Its like it doesnt run..?


Though I can see in the debugger that it is instantiated.



payload.config.ts


const mockModulePath = path.resolve(__dirname, 'mocks/serverModule.js');


// some config and then
webpack: (config) => ({
      plugins: [...config.plugins, plugin],
      ...config,
      resolve: {
        ...config.resolve,
        alias: {
          BundleAnalyzerPlugin: mockModulePath,
          [path.resolve(__dirname, 'bundleAnalyzer')]: mockModulePath
        }
      }
    })


bundleAnalyzer.ts



import { BundleAnalyzerPlugin } from 'webpack-bundle-analyzer';
const plugin = new BundleAnalyzerPlugin({});

export default plugin;


Figured it out, ...config was overwriting my plugin 🙂

    Star on GitHub

    Star

    Chat on Discord

    Discord

    online

    Can't find what you're looking for?

    Get dedicated engineering support directly from the Payload team.