From c5b932b7f596ae1f9d3a1c000ac287b2d1c77889 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?V=C3=ADt=20Bokisch?= Date: Mon, 25 May 2026 14:02:54 +0200 Subject: [PATCH] docs(tools-rolldown): document configurable sourcemap option Adds the sourcemap entry to the config reference and a dedicated "## Sourcemaps" section covering the 4 values (true | 'hidden' | 'inline' | false) with the value matrix and the canonical 'hidden' privacy-without-losing-debuggability use case. Covers vitus-labs/tools#141. --- content/docs/tools-rolldown/index.mdx | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/content/docs/tools-rolldown/index.mdx b/content/docs/tools-rolldown/index.mdx index dc3081b..88fbee8 100644 --- a/content/docs/tools-rolldown/index.mdx +++ b/content/docs/tools-rolldown/index.mdx @@ -71,6 +71,7 @@ export default { replaceGlobals: true, // Inject platform globals (default: true) typescript: true, // Generate .d.ts files (default: true) filesize: true, // Show file sizes in console (default: true) + sourcemap: true, // true | false | 'hidden' | 'inline' (default: true) visualise: { // Bundle visualization template: 'network', // 'network' | 'treemap' | 'sunburst' gzipSize: true, @@ -230,6 +231,28 @@ lib/analysis/index.html Templates: `'network'` (default), `'treemap'`, `'sunburst'` +## Sourcemaps + +JS-bundle sourcemap generation mirrors rolldown's native `output.sourcemap` API: + +| `sourcemap` | Emits | `sourceMappingURL` comment | Use when | +|---|---|---|---| +| `true` (default) | separate `.js.map` file | yes | OSS libraries — full debuggability | +| `'hidden'` | separate `.js.map` file | **no** | Closed-source: ship maps to error-reporting service (Sentry, etc.) without leaking via the bundle | +| `'inline'` | base64 map embedded in `.js` | n/a | Very small bundles, simpler deploy | +| `false` | nothing | n/a | You explicitly don't want maps | + +```js +// vl-tools.config.mjs — privacy without losing debuggability +export default { + build: { + sourcemap: 'hidden', + }, +} +``` + +DTS output never includes sourcemaps (declarations don't need them). + ## Advanced Build Options For non-library builds such as Chrome extensions, CLI tools, serverless functions, or Electron apps, you can bypass the `package.json`-driven pipeline with explicit configuration: