Bundleless means that each source file is compiled and built separately, which can be understood as the process of code conversion of source files only. To skip the preprocessing of .less/.scss
files, you need to:
source.entry
to remove .less/.scss
files from the entry.output.copy
to copy .less/.scss
files to the output directory.redirect.style.extension
to false
to disable the redirect behavior for the import path of .less/.scss
files.Below is an example of skipping the .scss
file processing. All .scss
files in src
will be copied to the output directory and retained with consistent relative paths.
By default, Rslib uses SWC to remove comments. The corresponding SWC jsc.minify.format configuration is
This will only preserve some legal comments and annotations. If you want to preserve all comments, you can refer to the following configuration
Compressing code can reduce the output size and improve loading speed, but the compressed code is less readable and harder to debug. If you want to preserve code readability, you can keep variable names and disable compression to facilitate debugging. Refer to web-infra-dev/rsbuild#966.
dts.bundle
is true
?Rslib uses rsbuild-plugin-dts to generate d.ts files, which supports configuration via output.externals for excluding certain dependencies from bundled d.ts files.
For example, a typical React component library often does not declare @types/react in peerDependencies but only in devDependencies. Following the autoExternal logic for dependency handling, Rslib will attempt to bundle @types/react into the d.ts artifact during the build. However, in practice, a component library should not bundle @types/react.
In this scenario, you can configure output.externals to exclude @types/react.