By default, Rsbuild will use the public
directory as the directory for serving public assets, files in this directory will be served at /
.
Related document: Public Folder.
The ability to serve public assets can be disabled by setting publicDir
to false
:
When the value of publicDir
is of object type, Rsbuild will merge the current configuration with the default configuration.
For example, to set the public folder name as static
and disable copyOnBuild
:
Note that setting the value of copyOnBuild
to false means that when you run rsbuild preview
for a production preview, you will not be able to access the corresponding static resources.
Setting watch
to true
allows the development environment to watch changes to files in the specified public directory and reload the page when the files are changed:
Note that the watch
option is only valid in the development build. If dev.hmr
and dev.liveReload
are both set to false, watch
will be ignored.
The value of name
can be set to a relative path or an absolute path. Relative path will be resolved relative to the project root directory.