Skip to content

Commit

Permalink
docs: complete options documentation (#8)
Browse files Browse the repository at this point in the history
  • Loading branch information
chenjiahan authored Nov 3, 2024
1 parent f838012 commit e7a497a
Show file tree
Hide file tree
Showing 2 changed files with 71 additions and 0 deletions.
55 changes: 55 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,61 @@ new ReactRefreshPlugin({
});
```

### forceEnable

- Type: `boolean`
- Default: `false`

Whether to force enable the plugin.

By default, the plugin will not be enabled in non-development environments. If you want to force enable the plugin, you can set this option to `true`.

```js
new ReactRefreshPlugin({
forceEnable: true,
});
```

It is useful if you want to:

- Use the plugin in production.
- Use the plugin with the `none` mode without setting `NODE_ENV`.
- Use the plugin in environments we do not support, such as `electron-prerender` (**WARNING: Proceed at your own risk**).

### library

- Type: `string`
- Default: `output.uniqueName || output.library`

Sets a namespace for the React Refresh runtime.

It is most useful when multiple instances of React Refresh is running together simultaneously.

### overlay

- Type: `boolean | OverlayOptions`
- Default: `false`

Modify the behavior of the error overlay.

- Enable the error overlay:

```js
new ReactRefreshPlugin({
overlay: true,
});
```

- Configure the error overlay:

```js
new ReactRefreshPlugin({
overlay: {
// ...
},
});
```

## Credits

Thanks to the [react-refresh-webpack-plugin](https://github.com/pmmmwh/react-refresh-webpack-plugin) created by [@pmmmwh](https://github.com/pmmmwh), which inspires implement this plugin.
Expand Down
16 changes: 16 additions & 0 deletions src/options.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,24 @@ export type PluginOptions = {
* @default /node_modules/
*/
exclude?: RuleSetCondition | null;
/**
* Sets a namespace for the React Refresh runtime.
* It is most useful when multiple instances of React Refresh is running
* together simultaneously.
* @default `output.uniqueName || output.library`
*/
library?: string;
/**
* Whether to force enable the plugin.
* By default, the plugin will not be enabled in non-development environments.
* If you want to force enable the plugin, you can set this option to `true`.
* @default false
*/
forceEnable?: boolean;
/**
* Modify the behavior of the error overlay.
* @default false
*/
overlay?: boolean | OverlayOptions;
};

Expand Down

0 comments on commit e7a497a

Please sign in to comment.