false
Used to enable lazy compilation (compilation on demand), implemented based on Rspack's experiments.lazyCompilation.
Lazy compilation is an excellent way to improve dev startup performance. It compiles modules on demand rather than compiling all modules at startup. This means developers can quickly see the application running when they start the dev server and build the necessary modules in stages.
Although Rspack itself has good performance, the overall build time can still be less than ideal when building applications with a large number of modules. This is because the modules in the application need to be compiled by various loaders, such as postcss-loader, sass-loader, vue-loader, etc., which introduce additional compilation overhead.
With lazy compilation enabled, Rspack will only compile the entrypoints and dynamic import modules that are requested. This can significantly reduce the number of modules that are compiled at development startup, improving startup time.
This is equivalent to the following configuration:
Use lazyCompilation.entries
to control whether to lazily compile entry modules:
With the entries
option enabled, Rsbuild will not compile all pages when you start the dev server. Instead, it will only compile a specific page when you visit it.
When lazily compiling entry modules, please note:
Use lazyCompilation.imports
to control whether to lazily compile dynamic imported modules.
When the imports
option is enabled, all async modules will only be compiled when requested. If your project is a single-page application (SPA) and you have split the routes using dynamic import, this will significantly speed up the startup time.