Vite (Svelte, Solid, Preact, Lit)
Vite builds ES module bundles into dist/assets, so scan with --es6Modules.
Step 1: Source maps
// vite.config.js
import { defineConfig } from 'vite';
export default defineConfig({
build: {
sourcemap: true, // or 'hidden': no sourceMappingURL comment, .map files still next to the bundles
},
});Do not use sourcemap: 'inline' if you deploy the build output without the scan step in between: inline maps stay inside the bundles.
Step 2: Build, scan and instrument
printf '%s' "$SEALIGHTS_AGENT_TOKEN" > sltoken.txt
npm ci
npx vite 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 --es6Modules \
--instrumentForBrowsers --outputPath sl_dist \
--labId qa-env --excludeSourceMapFiles skipCopyDeploy the contents of sl_dist in place of dist.
Vite-specific notes
Svelte
svelte and @sveltejs/ inside your bundles are not instrumented by default.
SvelteKit, SolidStart, Astro with server rendering
Scan the client output with --instrumentForBrowsers and the server output without it, each with its own --moduleName, like the Next.js setup. With a static adapter (no server), scan the static output only.
base option (app served under a sub-path)
With --splitPreambleIntoFile, pass a full URL in --preambleFileUrl that includes the sub-path.
Legacy plugin (@vitejs/plugin-legacy)
It emits *-legacy-*.js copies for old browsers. Exclude them in .slignore (**/*-legacy-*.js), or they are reported as duplicate methods.
Vitest unit tests
Captured separately; see Other Test Frameworks.
Last updated
Was this helpful?

