RuntimeChunkPlugin
RuntimeChunkPlugin creates separate runtime chunks and controls how they are named. optimization.runtimeChunk applies this plugin internally.
Options
name
Used to configure the name of the runtime chunk; it can be a string or a function that returns a string, where the function parameter is the name of the entry.
- Type:
string | ((entrypoint: { name: string }) => string)
Example
This configuration extracts the runtime used by two entry points into runtime.js:
rspack.config.mjs
Rspack emits app.js, admin.js, and the shared runtime.js. Keeping the runtime separate allows entry bundles to be cached independently from runtime changes.

