Rsbuild and Rspack
Applies to: applications built with Rsbuild or directly with Rspack, including Rsbuild-based React, Vue and Svelte templates.
Rsbuild builds with Rspack (a webpack-compatible bundler) and writes classic-script bundles to dist/static/js by default, so do not add --es6Modules unless you changed the output to ES modules.
Step 1: Source maps
Rsbuild turns JavaScript source maps off in production builds by default. Turn them on:
// rsbuild.config.ts
import { defineConfig } from '@rsbuild/core';
export default defineConfig({
output: {
sourceMap: {
js: 'source-map', // or 'hidden-source-map'
},
},
});// rspack.config.js
module.exports = {
mode: 'production',
devtool: 'source-map', // or 'hidden-source-map'
// ...
};Do not use cheap-* or eval-* values; see the devtool table on webpack.
Step 2: Build, scan and instrument
printf '%s' "$SEALIGHTS_AGENT_TOKEN" > sltoken.txt
npm ci
npx rsbuild build # or: npx rspack build
npx slnodejs config --tokenFile sltoken.txt --appName my-web-app \
--branchName "$BRANCH_NAME" --buildName "$BUILD_NUMBER"
npx slnodejs scan --tokenFile sltoken.txt --buildSessionIdFile buildSessionId \
--scanDir dist --scmType git \
--instrumentForBrowsers --outputPath sl_dist \
--labId qa-env --excludeSourceMapFiles skipCopyDeploy the contents of sl_dist in place of dist.
Rsbuild-specific notes
output.distPath.root changed
Use that folder as --scanDir.
lib-*.js / vendors-*.js split chunks
They hold node_modules code. Exclude them in .slignore (for example **/lib-*.js), or rely on .slignore.instrument for framework packages.
webpack:// or rspack:// source paths
Remove framework-generated sources from the scan result with .slignore.generated (for example webpack:/**).
Module Federation
See Micro-frontends.
Last updated
Was this helpful?

