Unverified Commit 115b6ad9 authored by JJ Kasper's avatar JJ Kasper Committed by GitHub

Allow configuring analyzerMode in bundle-analyzer (#47468)

It's valid to want to output JSON instead of HTML for the bundle
analyzer so we can expose this specific config the same as
`openAnalyzer`. cc @mknichel
parent 40ce6219
import type { NextConfig } from 'next'
declare const NextBundleAnalyzer =
(options?: { enabled?: boolean; openAnalyzer?: boolean }) =>
(config?: NextConfig) =>
NextConfig
declare function NextBundleAnalyzer(options?: {
enabled?: boolean
openAnalyzer?: boolean
analyzerMode?: 'json' | 'static'
}): (config?: NextConfig) => NextConfig
export = NextBundleAnalyzer
module.exports =
({ enabled = true, openAnalyzer = true } = {}) =>
({ enabled = true, openAnalyzer, analyzerMode } = {}) =>
(nextConfig = {}) => {
return Object.assign({}, nextConfig, {
webpack(config, options) {
......@@ -7,7 +7,7 @@ module.exports =
const { BundleAnalyzerPlugin } = require('webpack-bundle-analyzer')
config.plugins.push(
new BundleAnalyzerPlugin({
analyzerMode: 'static',
analyzerMode: analyzerMode || 'static',
openAnalyzer,
reportFilename: !options.nextRuntime
? `./analyze/client.html`
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment