Base code
This commit is contained in:
41
frontend/scripts/analyze-bundle.js
Normal file
41
frontend/scripts/analyze-bundle.js
Normal file
@@ -0,0 +1,41 @@
|
||||
const { BundleAnalyzerPlugin } = require('webpack-bundle-analyzer');
|
||||
const path = require('path');
|
||||
|
||||
module.exports = {
|
||||
mode: 'production',
|
||||
entry: './src/index.tsx',
|
||||
output: {
|
||||
path: path.resolve(__dirname, '../build'),
|
||||
filename: 'static/js/[name].[contenthash:8].js',
|
||||
chunkFilename: 'static/js/[name].[contenthash:8].chunk.js',
|
||||
},
|
||||
plugins: [
|
||||
new BundleAnalyzerPlugin({
|
||||
analyzerMode: 'static',
|
||||
openAnalyzer: false,
|
||||
reportFilename: '../bundle-report.html',
|
||||
}),
|
||||
],
|
||||
optimization: {
|
||||
splitChunks: {
|
||||
chunks: 'all',
|
||||
cacheGroups: {
|
||||
vendor: {
|
||||
test: /[\\/]node_modules[\\/]/,
|
||||
name: 'vendors',
|
||||
chunks: 'all',
|
||||
},
|
||||
mui: {
|
||||
test: /[\\/]node_modules[\\/]@mui[\\/]/,
|
||||
name: 'mui',
|
||||
chunks: 'all',
|
||||
},
|
||||
framer: {
|
||||
test: /[\\/]node_modules[\\/]framer-motion[\\/]/,
|
||||
name: 'framer-motion',
|
||||
chunks: 'all',
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
};
|
||||
Reference in New Issue
Block a user