Output files
This section covers the output file directory structure and how to control output directories for different file types.
To learn about deploying Rsbuild build outputs as a static site, see Deploy Static Site.
Default directory structure
The default output directory structure is shown below. Output files are written to the dist directory at your project root.
The most common output files are HTML, JS, and CSS files:
- HTML files: written to the root of the dist directory by default.
- JS files: written to the
static/jsdirectory by default. - CSS files: written to the
static/cssdirectory by default.
Additional files may be generated alongside JS and CSS files:
- License files: contain open-source license information, written to the same directory as JS files with a
.LICENSE.txtsuffix. - Source map files: contain source mapping information, written to the same directory as JS and CSS files with a
.mapsuffix.
In the filename, [name] represents the entry name for this file, such as index or main. [hash] is a hash value generated based on the file content.
Development mode output
In development mode, Rsbuild stores build outputs in memory on the dev server by default rather than writing them to disk. This reduces file system overhead. See View static assets to view all static assets generated during the current build.
To write output files to disk (useful for inspecting build artifacts or configuring proxy rules), set dev.writeToDisk to true:
Modify the output directory
Rsbuild provides several options to customize output directories or filenames:
- Use output.filename to modify the filename.
- Use output.distPath to modify the output path.
- Use output.legalComments to modify the license file output.
- Use output.sourceMap to modify source map output.
- Use html.outputStructure to modify the output structure of HTML files.
Static assets
Static assets imported in your code (images, SVG, fonts, media, etc.) are written to the dist/static directory and automatically organized by file type:
Configure output.distPath to write static assets to a single directory. For example, to place them all in an assets directory:
This configuration generates the following directory structure:
Node.js output directory
With output.target set to 'node', Rsbuild generates output files for Node.js:
Node.js outputs typically contain only JS files, without HTML or CSS. JS filenames do not include hash values.
You can modify the output path for Node.js files using the environments configuration.
For example, to write Node.js files to the server directory:
Flatten directories
To create a flatter directory structure, set any directory path to an empty string.
For example:
This configuration generates the following directory structure:

