source.entry
- Type:
- Default:
Set the entry modules for building.
source.entry is an object where the key is the entry name and the value is the path of the entry module or a description object.
If the value is a path, it can be an absolute path or a relative path. Relative paths will be resolved based on root.
HTML generation
Rsbuild will register html-rspack-plugin for each entry in source.entry and generate the corresponding HTML files.
- Example:
The generated directory structure is as follows:
If you do not need to generate HTML files:
- Set the html property to
falsein the entry description object to disable the HTML generation for a single entry. - Set tools.htmlPlugin to
falseto disable the HTML generation for all entries.
Description object
source.entry also supports Rspack's entry description object. For example:
html property
Rsbuild has added an html property to the description object that controls whether an HTML file is generated.
For example, the bar entry does not generate an HTML file:
In the above example, foo.html will be generated, while bar.html will not be generated.
For detailed usage of the description object, refer to Rspack - Entry description object.
Set by environment
When you build for multiple environments, you can set different entry for each environment:
For example, set different entry for web and node environments:
Asynchronous setting
To set entry asynchronously, for example, use glob to scan the directory, you can export an async function in rsbuild.config.ts:

