Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

doc: Add output/config guides #4041

Merged
merged 1 commit into from
Nov 22, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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