X-Git-Url: https://git.immae.eu/?a=blobdiff_plain;f=client%2Fconfig%2Fwebpack.common.js;h=08b8a4b09cedf69aa44a3804ba5f984b1e4400c3;hb=b99290b1d5d736083513fb8f66e91f61bfe07e0b;hp=223f55c2e39aab1894b8dca120b4c62c7ef48f1e;hpb=11ac88de40215783835cf6e6259ff0f6cee258dd;p=github%2FChocobozzz%2FPeerTube.git diff --git a/client/config/webpack.common.js b/client/config/webpack.common.js index 223f55c2e..08b8a4b09 100644 --- a/client/config/webpack.common.js +++ b/client/config/webpack.common.js @@ -5,6 +5,7 @@ const helpers = require('./helpers') */ const AssetsPlugin = require('assets-webpack-plugin') +const BundleAnalyzerPlugin = require('webpack-bundle-analyzer').BundleAnalyzerPlugin const NormalModuleReplacementPlugin = require('webpack/lib/NormalModuleReplacementPlugin') const ContextReplacementPlugin = require('webpack/lib/ContextReplacementPlugin') const CommonsChunkPlugin = require('webpack/lib/optimize/CommonsChunkPlugin') @@ -313,6 +314,30 @@ module.exports = function (options) { disabled: !AOT, tsConfig: helpers.root('tsconfig.webpack.json'), resourceOverride: helpers.root('config/resource-override.js') + }), + + new BundleAnalyzerPlugin({ + // Can be `server`, `static` or `disabled`. + // In `server` mode analyzer will start HTTP server to show bundle report. + // In `static` mode single HTML file with bundle report will be generated. + // In `disabled` mode you can use this plugin to just generate Webpack Stats JSON file by setting `generateStatsFile` to `true`. + analyzerMode: 'static', + // Path to bundle report file that will be generated in `static` mode. + // Relative to bundles output directory. + reportFilename: 'report.html', + // Automatically open report in default browser + openAnalyzer: false, + // If `true`, Webpack Stats JSON file will be generated in bundles output directory + generateStatsFile: true, + // Name of Webpack Stats JSON file that will be generated if `generateStatsFile` is `true`. + // Relative to bundles output directory. + statsFilename: 'stats.json', + // Options for `stats.toJson()` method. + // For example you can exclude sources of your modules from stats file with `source: false` option. + // See more options here: https://github.com/webpack/webpack/blob/webpack-1/lib/Stats.js#L21 + statsOptions: null, + // Log level. Can be 'info', 'warn', 'error' or 'silent'. + logLevel: 'info' }) ],