Skip to content

Commit e7a497a

Browse files
authored
docs: complete options documentation (#8)
1 parent f838012 commit e7a497a

File tree

2 files changed

+71
-0
lines changed

2 files changed

+71
-0
lines changed

README.md

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -109,6 +109,61 @@ new ReactRefreshPlugin({
109109
});
110110
```
111111

112+
### forceEnable
113+
114+
- Type: `boolean`
115+
- Default: `false`
116+
117+
Whether to force enable the plugin.
118+
119+
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`.
120+
121+
```js
122+
new ReactRefreshPlugin({
123+
forceEnable: true,
124+
});
125+
```
126+
127+
It is useful if you want to:
128+
129+
- Use the plugin in production.
130+
- Use the plugin with the `none` mode without setting `NODE_ENV`.
131+
- Use the plugin in environments we do not support, such as `electron-prerender` (**WARNING: Proceed at your own risk**).
132+
133+
### library
134+
135+
- Type: `string`
136+
- Default: `output.uniqueName || output.library`
137+
138+
Sets a namespace for the React Refresh runtime.
139+
140+
It is most useful when multiple instances of React Refresh is running together simultaneously.
141+
142+
### overlay
143+
144+
- Type: `boolean | OverlayOptions`
145+
- Default: `false`
146+
147+
Modify the behavior of the error overlay.
148+
149+
- Enable the error overlay:
150+
151+
```js
152+
new ReactRefreshPlugin({
153+
overlay: true,
154+
});
155+
```
156+
157+
- Configure the error overlay:
158+
159+
```js
160+
new ReactRefreshPlugin({
161+
overlay: {
162+
// ...
163+
},
164+
});
165+
```
166+
112167
## Credits
113168

114169
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.

src/options.ts

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,24 @@ export type PluginOptions = {
2424
* @default /node_modules/
2525
*/
2626
exclude?: RuleSetCondition | null;
27+
/**
28+
* Sets a namespace for the React Refresh runtime.
29+
* It is most useful when multiple instances of React Refresh is running
30+
* together simultaneously.
31+
* @default `output.uniqueName || output.library`
32+
*/
2733
library?: string;
34+
/**
35+
* Whether to force enable the plugin.
36+
* By default, the plugin will not be enabled in non-development environments.
37+
* If you want to force enable the plugin, you can set this option to `true`.
38+
* @default false
39+
*/
2840
forceEnable?: boolean;
41+
/**
42+
* Modify the behavior of the error overlay.
43+
* @default false
44+
*/
2945
overlay?: boolean | OverlayOptions;
3046
};
3147

0 commit comments

Comments
 (0)