import type ChainConfig from 'webpack-chain' ; import { AnalyzePlugin } from './pluginBase' ; export class BundleAnalyzePlugin extends AnalyzePlugin { options = [ { analyzerMode : 'server' , } , ] ; afterBuild = ( ) => new Promise ( ( ) => null ) ; get plugin ( ) { return require ( 'webpack-bundle-analyzer' ) . BundleAnalyzerPlugin ; } patchConfigInternal ( config ) { super . patchConfigInternal ( config ) ; if ( config . output . get ( 'libraryTarget' ) === 'lazy' ) { config . output . libraryTarget ( 'commonjs' ) ; } config . optimization . set ( 'concatenateModules' , false ) ; return config ; } }