diff --git a/config/webpack.library.js b/config/webpack.library.js index 517cabb5..381e92ba 100644 --- a/config/webpack.library.js +++ b/config/webpack.library.js @@ -1,6 +1,7 @@ const path = require("path"); const webpack = require("webpack"); const UglifyJsPlugin = require("uglifyjs-webpack-plugin"); +const { BundleAnalyzerPlugin } = require("webpack-bundle-analyzer"); module.exports = { node: { @@ -40,6 +41,11 @@ module.exports = { noParse: [/jszip\.js$/] }, plugins: [ + new BundleAnalyzerPlugin({ + analyzerMode: "static", + reportFilename: "library-report.html", + openAnalyzer: false + }), new webpack.DefinePlugin({ "process.env": { NODE_ENV: JSON.stringify("production") diff --git a/config/webpack.prod.js b/config/webpack.prod.js index beb3726a..86c781c9 100644 --- a/config/webpack.prod.js +++ b/config/webpack.prod.js @@ -3,6 +3,8 @@ const merge = require("webpack-merge"); const workboxPlugin = require("workbox-webpack-plugin"); const GitRevisionPlugin = require("git-revision-webpack-plugin"); const UglifyJsPlugin = require("uglifyjs-webpack-plugin"); +const { BundleAnalyzerPlugin } = require("webpack-bundle-analyzer"); + const common = require("./webpack.common.js"); const gitRevisionPlugin = new GitRevisionPlugin(); @@ -10,6 +12,11 @@ const gitRevisionPlugin = new GitRevisionPlugin(); const config = merge(common, { devtool: "source-map", plugins: [ + new BundleAnalyzerPlugin({ + analyzerMode: "static", + reportFilename: "prod-report.html", + openAnalyzer: false + }), new webpack.DefinePlugin({ "process.env": { NODE_ENV: JSON.stringify("production")