This package has been deprecated

Author message:

The bundle analyzer has been moved to https://www.npmjs.com/package/@next/bundle-analyzer

@zeit/next-bundle-analyzer

0.1.2 • Public • Published

Next.js + Webpack Bundle Analyzer

Use webpack-bundle-analyzer in your Next.js project

Installation

npm install --save @zeit/next-bundle-analyzer

or

yarn add @zeit/next-bundle-analyzer

Usage with environment variables

Create a next.config.js (and make sure you have next-css set up)

const withBundleAnalyzer = require("@zeit/next-bundle-analyzer");

module.exports = withBundleAnalyzer({
  analyzeServer: ["server", "both"].includes(process.env.BUNDLE_ANALYZE),
  analyzeBrowser: ["browser", "both"].includes(process.env.BUNDLE_ANALYZE),
  bundleAnalyzerConfig: {
    server: {
      analyzerMode: 'static',
      reportFilename: '../../bundles/server.html'
    },
    browser: {
      analyzerMode: 'static',
      reportFilename: '../bundles/client.html'
    }
  }
});

Then you can run one of these commands:

# Build and analyze the back end server bundle
BUNDLE_ANALYZE=server yarn build

# Build and analyze the front end browser bundle
BUNDLE_ANALYZE=browser yarn build

# Build and analyze both server and browser
BUNDLE_ANALYZE=both yarn build

# Build and analyze neither server nor browser
yarn build

If you choose both then two different browser windows will open. One will be for the server bundle, one for the browser bundle.

Readme

Keywords

none

Package Sidebar

Install

npm i @zeit/next-bundle-analyzer

Weekly Downloads

4,124

Version

0.1.2

License

MIT

Unpacked Size

3.79 kB

Total Files

4

Last publish

Collaborators

  • gdborton
  • matheuss
  • matt.straka
  • nick.tracey
  • zeit-bot
  • vercel-release-bot