diff options
author | Mike Greiling <mike@pixelcog.com> | 2017-02-20 15:42:51 -0600 |
---|---|---|
committer | Mike Greiling <mike@pixelcog.com> | 2017-02-21 16:29:35 -0600 |
commit | 9a11acabb90ca0bd0826c5c21b09f96015337537 (patch) | |
tree | 4fdc6d6de7de30ac0e7de1ee6c37987d6dcd3eba /config | |
parent | cac59408a58a8c6d2c3ce4fa5a27161a186b5ed5 (diff) | |
download | gitlab-ce-9a11acabb90ca0bd0826c5c21b09f96015337537.tar.gz |
add webpack bundle analyzer to production output
Diffstat (limited to 'config')
-rw-r--r-- | config/webpack.config.js | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/config/webpack.config.js b/config/webpack.config.js index 15899993874..e754f68553a 100644 --- a/config/webpack.config.js +++ b/config/webpack.config.js @@ -5,12 +5,14 @@ var path = require('path'); var webpack = require('webpack'); var StatsPlugin = require('stats-webpack-plugin'); var CompressionPlugin = require('compression-webpack-plugin'); +var BundleAnalyzerPlugin = require('webpack-bundle-analyzer').BundleAnalyzerPlugin; var ROOT_PATH = path.resolve(__dirname, '..'); var IS_PRODUCTION = process.env.NODE_ENV === 'production'; var IS_DEV_SERVER = process.argv[1].indexOf('webpack-dev-server') !== -1; var DEV_SERVER_PORT = parseInt(process.env.DEV_SERVER_PORT, 10) || 3808; var DEV_SERVER_LIVERELOAD = process.env.DEV_SERVER_LIVERELOAD !== 'false'; +var WEBPACK_REPORT = process.env.WEBPACK_REPORT; var config = { context: path.join(ROOT_PATH, 'app/assets/javascripts'), @@ -120,4 +122,16 @@ if (IS_DEV_SERVER) { config.output.publicPath = '//localhost:' + DEV_SERVER_PORT + config.output.publicPath; } +if (WEBPACK_REPORT) { + config.plugins.push( + new BundleAnalyzerPlugin({ + analyzerMode: 'static', + generateStatsFile: true, + openAnalyzer: false, + reportFilename: path.join(ROOT_PATH, 'webpack-report/index.html'), + statsFilename: path.join(ROOT_PATH, 'webpack-report/stats.json'), + }) + ); +} + module.exports = config; |