Skip to content

Commit

Permalink
Merge pull request #4041 from relative-ci/update-config-docs
Browse files Browse the repository at this point in the history
doc: Add output/config guides
  • Loading branch information
vio committed Nov 22, 2023
2 parents 96a92aa + ab58e41 commit 908ea37
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 4 deletions.
13 changes: 10 additions & 3 deletions packages/cli/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -63,28 +63,35 @@ or
yarn add --dev bundle-stats
```

## Webpack configuration
## Output webpack stats

The CLI is consuming the Webpack stats json. The following [stats options](https://webpack.js.org/configuration/stats) are required:
The CLI is consuming the Webpack stats JSON file. The following [webpack stats options](https://webpack.js.org/configuration/stats) are needed:

```js
{
stats: {
// required
assets: true,
chunks: true,
modules: true,
// optional
builtAt: true,
hash: true
}
}
```

You can output the stats json file using [webpack-cli](https://www.npmjs.com/package/webpack-cli):
[How to configure webpack for better debugging and monitoring](https://relative-ci.com/documentation/guides/webpack-config)

You can output the webpack stats JSON file using [webpack-cli](https://www.npmjs.com/package/webpack-cli) `--json` option:

```shell
npx webpack --mode production --json artifacts/webpack-stats.json
```

- [How to output webpack stats JSON file using webpack-cli](https://relative-ci.com/documentation/guides/webpack-stats/webpack-cli)
- [How to output webpack stats JSON file using webpack-stats-plugin](https://relative-ci.com/documentation/guides/webpack-stats/webpack-stats-plugin)

## Usage

```shell
Expand Down
2 changes: 2 additions & 0 deletions packages/rollup-plugin/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,8 @@ module.exports = {
};
```

[How to configure Vite for better debugging and monitoring](https://relative-ci.com/documentation/guides/vite-config)

### Options

- `compare` - use local saved stats for comparison (default `true`).
Expand Down
3 changes: 2 additions & 1 deletion packages/webpack-plugin/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,6 @@ module.exports = {
]
}
```

### `BundleStatsWebpackPlugin(options)`

- `compare` - use local saved baseline for comparison (default `true`).
Expand All @@ -88,6 +87,8 @@ module.exports = {
}
```

[How to configure webpack for better debugging and monitoring](https://relative-ci.com/documentation/guides/webpack-config)

### Use with create-react-app

You will need to customize the default webpack config. That can be done by using [react-app-rewired](https://github.com/timarney/react-app-rewired) which is one of create-react-app's custom config solutions. You will also need [customize-cra](https://github.com/arackaf/customize-cra).
Expand Down

0 comments on commit 908ea37

Please sign in to comment.