An open API service indexing awesome lists of open source software.

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

Awesome Lists containing this project

README

          

[![npm version](https://badge.fury.io/js/razzle-plugin-bundle-analyzer.svg)](https://badge.fury.io/js/razzle-plugin-bundle-analyzer)

[![All Contributors](https://img.shields.io/badge/all_contributors-1-orange.svg?style=flat-square)](#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)):



Nima Arefi

🚇 ⚠️ 💻

This project follows the [all-contributors](https://github.com/all-contributors/all-contributors) specification. Contributions of any kind welcome!