Unverified Commit 19fa1fa5 authored by quisi.do's avatar quisi.do Committed by GitHub

add `logLevel` support to `@next/bundle-analyzer` (#59228)

Co-authored-by: 's avatarJiachi Liu <inbox@huozhi.im>
parent 7a733dfd
...@@ -4,6 +4,12 @@ declare function NextBundleAnalyzer(options?: { ...@@ -4,6 +4,12 @@ declare function NextBundleAnalyzer(options?: {
enabled?: boolean enabled?: boolean
openAnalyzer?: boolean openAnalyzer?: boolean
analyzerMode?: 'json' | 'static' analyzerMode?: 'json' | 'static'
/**
* Log level. Can be 'info', 'warn', 'error' or 'silent'.
* @default 'info'
*/
logLevel?: 'info' | 'warn' | 'error' | 'silent' | undefined
}): (config?: NextConfig) => NextConfig }): (config?: NextConfig) => NextConfig
export = NextBundleAnalyzer export = NextBundleAnalyzer
module.exports = module.exports =
({ enabled = true, openAnalyzer, analyzerMode } = {}) => ({ enabled = true, logLevel, openAnalyzer, analyzerMode } = {}) =>
(nextConfig = {}) => { (nextConfig = {}) => {
return Object.assign({}, nextConfig, { return Object.assign({}, nextConfig, {
webpack(config, options) { webpack(config, options) {
...@@ -8,6 +8,7 @@ module.exports = ...@@ -8,6 +8,7 @@ module.exports =
config.plugins.push( config.plugins.push(
new BundleAnalyzerPlugin({ new BundleAnalyzerPlugin({
analyzerMode: analyzerMode || 'static', analyzerMode: analyzerMode || 'static',
logLevel,
openAnalyzer, openAnalyzer,
reportFilename: !options.nextRuntime reportFilename: !options.nextRuntime
? `./analyze/client.html` ? `./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