add logLevel
support to @next/bundle-analyzer
(#59228)
Co-authored-by: Jiachi Liu <inbox@huozhi.im>
This commit is contained in:
parent
7a733dfd34
commit
19fa1fa579
2 changed files with 8 additions and 1 deletions
6
packages/next-bundle-analyzer/index.d.ts
vendored
6
packages/next-bundle-analyzer/index.d.ts
vendored
|
@ -4,6 +4,12 @@ declare function NextBundleAnalyzer(options?: {
|
|||
enabled?: boolean
|
||||
openAnalyzer?: boolean
|
||||
analyzerMode?: 'json' | 'static'
|
||||
|
||||
/**
|
||||
* Log level. Can be 'info', 'warn', 'error' or 'silent'.
|
||||
* @default 'info'
|
||||
*/
|
||||
logLevel?: 'info' | 'warn' | 'error' | 'silent' | undefined
|
||||
}): (config?: NextConfig) => NextConfig
|
||||
|
||||
export = NextBundleAnalyzer
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
module.exports =
|
||||
({ enabled = true, openAnalyzer, analyzerMode } = {}) =>
|
||||
({ enabled = true, logLevel, openAnalyzer, analyzerMode } = {}) =>
|
||||
(nextConfig = {}) => {
|
||||
return Object.assign({}, nextConfig, {
|
||||
webpack(config, options) {
|
||||
|
@ -8,6 +8,7 @@ module.exports =
|
|||
config.plugins.push(
|
||||
new BundleAnalyzerPlugin({
|
||||
analyzerMode: analyzerMode || 'static',
|
||||
logLevel,
|
||||
openAnalyzer,
|
||||
reportFilename: !options.nextRuntime
|
||||
? `./analyze/client.html`
|
||||
|
|
Loading…
Reference in a new issue