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
|
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
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
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 =
|
||||||
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`
|
||||||
|
|
Loading…
Reference in a new issue