https://github.com/nimacsoft/razzle-plugin-bundle-analyzer
📰 Using Webpack Bundle Analyzer with Razzle
https://github.com/nimacsoft/razzle-plugin-bundle-analyzer
plugin razzle webpack-bundle-analyzer
Last synced: about 1 year ago
JSON representation
📰 Using Webpack Bundle Analyzer with Razzle
- Host: GitHub
- URL: https://github.com/nimacsoft/razzle-plugin-bundle-analyzer
- Owner: nimacsoft
- License: mit
- Created: 2019-06-13T13:00:40.000Z (about 7 years ago)
- Default Branch: master
- Last Pushed: 2023-01-07T14:00:19.000Z (over 3 years ago)
- Last Synced: 2025-04-30T13:28:07.917Z (about 1 year ago)
- Topics: plugin, razzle, webpack-bundle-analyzer
- Language: JavaScript
- Homepage:
- Size: 843 KB
- Stars: 5
- Watchers: 0
- Forks: 2
- Open Issues: 11
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
[](https://badge.fury.io/js/razzle-plugin-bundle-analyzer)
[](#contributors-)
# razzle-plugin-bundle-analyzer
This package contains a plugin for using webpack-bundle-analyzer with Razzle
Usage in Razzle Projects
```sh
yarn add razzle-plugin-bundle-analyzer --dev
```
create a **razzle.config.js** file in root directory of project (next to the *package.json*) and put this content inside it
Using the plugin with the default options
```javascript
// razzle.config.js
module.exports = {
plugins: ['bundle-analyzer'],
};
```
## With custom options:
```javascript
// razzle.config.js
module.exports = {
plugins: [
{
name: 'bundle-analyzer',
options: {
concatenateModules: false
}
}
]
};
```
## Options
concatenateModules: *boolean* (defaults: false)
Set `concatenateModules` to `true` if you want to webpack to find segments of the module graph which can be safely concatenated into a single module
### Customizing
You can also pass other [webpack-bundle-analyzer](https://github.com/webpack-contrib/webpack-bundle-analyzer) options in the options array. For example, to use this in Docker environments, you can set the `analyzerHost` to `0.0.0.0`.
```javascript
// razzle.config.js
module.exports = {
plugins: [
{
name: 'bundle-analyzer',
options: {
analyzerHost: '0.0.0.0'
}
}
]
};
```
See the full list of possible options [here](https://github.com/webpack-contrib/webpack-bundle-analyzer#options-for-plugin)
## Run Bundle Analyzer
Craete a new **script** in *package.json*
```json
"analyze": "BUNDLE_ANALYZE=true razzle build",
```
and start by run this command in terminal
```sh
yarn analyze
```
## Contributors ✨
Thanks goes to these wonderful people ([emoji key](https://allcontributors.org/docs/en/emoji-key)):
This project follows the [all-contributors](https://github.com/all-contributors/all-contributors) specification. Contributions of any kind welcome!