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.
The default output directory structure is shown below. Output files are written to the dist
directory in your project root.
The most common output files are HTML, JS, and CSS files:
static/js
directory by default.static/css
directory by default.Additional files may be generated alongside JS and CSS files:
.LICENSE.txt
suffix..map
suffix.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.
In development mode, Rsbuild stores build outputs in memory on the dev server by default instead of writing them to disk. This reduces file system overhead. Refer to View Static Assets to see all static assets generated in the current build.
To write output files to disk, which is useful for inspecting build artifacts or configuring proxy rules for static assets, set dev.writeToDisk to true
:
Rsbuild provides several options to customize output directories or filenames:
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 organize them in an assets
directory:
This configuration generates the following directory structure:
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:
To create a flatter directory structure, set any directory path to an empty string to flatten the output structure.
For example:
This configuration generates the following directory structure: