Skip to content

docs(configuration): update lazyCompilationBackend #5632

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

Merged
Merged
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
50 changes: 35 additions & 15 deletions src/content/configuration/experiments.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -181,31 +181,51 @@ module.exports = {
Compile entrypoints and dynamic `import`s only when they are in use. It can be used for either Web or Node.js.

- Type

- `boolean`
- `object`

```ts
{
// define a custom backend
backend?: ((
compiler: webpack.Compiler,
client: string,
callback: (err?: Error, api?: any) => void
// define a custom backend
backend?: ((
compiler: Compiler,
callback: (err?: Error, api?: BackendApi) => void
) => void)
| ((
compiler: webpack.Compiler,
client: string
) => Promise<any>)
client?: string,
entries?: boolean,
imports?: boolean,
test?: RegExp | string | ((module: import("../lib/Module")) => boolean)
| ((compiler: Compiler) => Promise<BackendApi>)
| {
/**
* A custom client.
*/
client?: string;

/**
* Specify where to listen to from the server.
*/
listen?: number | ListenOptions | ((server: typeof Server) => void);

/**
* Specify the protocol the client should use to connect to the server.
*/
protocol?: "http" | "https";

/**
* Specify how to create the server handling the EventSource requests.
*/
server?: ServerOptionsImport | ServerOptionsHttps | (() => typeof Server);

},
entries?: boolean,
imports?: boolean,
test?: string | RegExp | ((module: Module) => boolean)
}
```
- `client`: Path to a custom client, defaults to `webpack/hot/lazy-compilation-{node|web}.js`.
- `backend`: Customize the backend, defaults to `webpack/lib/hmr/lazyCompilationBackend`.

- `backend`: Customize the backend.
- `entries`: Enable lazy compilation for entries.
- `imports` <Badge text='5.20.0+' />: Enable lazy compilation for dynamic imports.
- `test` <Badge text='5.20.0+' />: Specify which imported modules should be lazily compiled.

- Available: 5.17.0+
- Example 1:
```js
Expand Down