Skip to content

Commit

Permalink
refactor: webpack analyzer on demand
Browse files Browse the repository at this point in the history
  • Loading branch information
mudassir-hafeez committed Sep 10, 2024
1 parent da69668 commit 9d8c23f
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 7 deletions.
4 changes: 0 additions & 4 deletions config/nginx.conf.erb
Original file line number Diff line number Diff line change
Expand Up @@ -72,10 +72,6 @@ http {
add_header Cache-Control private;
}

location = /static/bundles/report.html {
return 404;
}

location ~* /static/(.*$) {
expires max;
add_header Access-Control-Allow-Origin *;
Expand Down
13 changes: 10 additions & 3 deletions webpack.config.prod.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,8 @@ prodConfig.module.rules = [
},
];

const analyzeBundles = process.env.WEBPACK_ANALYZE === 'True';

module.exports = Object.assign(prodConfig, {
context: __dirname,
mode: "production",
Expand All @@ -53,9 +55,14 @@ module.exports = Object.assign(prodConfig, {
new MiniCssExtractPlugin({
filename: "[name]-[contenthash].css",
}),
new BundleAnalyzerPlugin({
analyzerMode: "static",
}),
...(analyzeBundles
? [
new BundleAnalyzerPlugin({
analyzerMode: "static",
}),
]
: []
),
],
optimization: {
minimize: true,
Expand Down

0 comments on commit 9d8c23f

Please sign in to comment.