Skip to content

Commit e844238

Browse files
authored
docs(configuration): update lazyCompilationBackend (#5632)
1 parent b8e06ab commit e844238

File tree

1 file changed

+35
-15
lines changed

1 file changed

+35
-15
lines changed

src/content/configuration/experiments.mdx

Lines changed: 35 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -181,31 +181,51 @@ module.exports = {
181181
Compile entrypoints and dynamic `import`s only when they are in use. It can be used for either Web or Node.js.
182182

183183
- Type
184+
184185
- `boolean`
185186
- `object`
187+
186188
```ts
187189
{
188-
// define a custom backend
189-
backend?: ((
190-
compiler: webpack.Compiler,
191-
client: string,
192-
callback: (err?: Error, api?: any) => void
190+
// define a custom backend
191+
backend?: ((
192+
compiler: Compiler,
193+
callback: (err?: Error, api?: BackendApi) => void
193194
) => void)
194-
| ((
195-
compiler: webpack.Compiler,
196-
client: string
197-
) => Promise<any>)
198-
client?: string,
199-
entries?: boolean,
200-
imports?: boolean,
201-
test?: RegExp | string | ((module: import("../lib/Module")) => boolean)
195+
| ((compiler: Compiler) => Promise<BackendApi>)
196+
| {
197+
/**
198+
* A custom client.
199+
*/
200+
client?: string;
201+
202+
/**
203+
* Specify where to listen to from the server.
204+
*/
205+
listen?: number | ListenOptions | ((server: typeof Server) => void);
206+
207+
/**
208+
* Specify the protocol the client should use to connect to the server.
209+
*/
210+
protocol?: "http" | "https";
211+
212+
/**
213+
* Specify how to create the server handling the EventSource requests.
214+
*/
215+
server?: ServerOptionsImport | ServerOptionsHttps | (() => typeof Server);
216+
217+
},
218+
entries?: boolean,
219+
imports?: boolean,
220+
test?: string | RegExp | ((module: Module) => boolean)
202221
}
203222
```
204-
- `client`: Path to a custom client, defaults to `webpack/hot/lazy-compilation-{node|web}.js`.
205-
- `backend`: Customize the backend, defaults to `webpack/lib/hmr/lazyCompilationBackend`.
223+
224+
- `backend`: Customize the backend.
206225
- `entries`: Enable lazy compilation for entries.
207226
- `imports` <Badge text='5.20.0+' />: Enable lazy compilation for dynamic imports.
208227
- `test` <Badge text='5.20.0+' />: Specify which imported modules should be lazily compiled.
228+
209229
- Available: 5.17.0+
210230
- Example 1:
211231
```js

0 commit comments

Comments
 (0)