Created
August 14, 2024 05:54
-
-
Save BiosBoy/40b0954ade5f978dc20590fd6a647f8c to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Webpack Bundle Analyzer Examples | |
## Install the Package | |
```bash | |
npm install --save-dev webpack-bundle-analyzer | |
const BundleAnalyzerPlugin = require('webpack-bundle-analyzer').BundleAnalyzerPlugin; | |
module.exports = { | |
// Your existing webpack config | |
plugins: [ | |
new BundleAnalyzerPlugin(), | |
], | |
}; | |
import _ from 'lodash'; | |
const result = _.merge(object1, object2); | |
import merge from 'lodash/merge'; | |
const result = merge(object1, object2); | |
webpack --profile --json > stats.json | |
npx webpack-bundle-analyzer stats.json | |
{ | |
"name": "your-project-name", | |
"version": "1.0.0", | |
"scripts": { | |
"build": "webpack --mode production", | |
"analyze": "webpack --profile --json > stats.json && webpack-bundle-analyzer stats.json" | |
}, | |
"devDependencies": { | |
"webpack": "^5.0.0", | |
"webpack-bundle-analyzer": "^4.0.0" | |
} | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment