Skip to content
Discussion options

You must be logged in to vote

That output is coming from the bundler, not from the source map flag. --sourcemap lets the debugger map generated code back to the original TypeScript, but it does not promise to preserve the generated JavaScript's local variables.

vp pack wraps tsdown, and the CLI exposes the relevant knobs:

vp pack --sourcemap --no-treeshake --unbundle

or in config:

export default defineConfig({
  pack: {
    sourcemap: true,
    treeshake: false,
    unbundle: true,
  },
})

If you still bundle into one file, Rolldown/tsdown may still simplify local constants in generated output. For debugging, the more reliable route is to debug through the source map in your original src/index.ts, or use unbundle/non-…

Replies: 1 comment 4 replies

Comment options

You must be logged in to vote
4 replies
@snebjorn
Comment options

@camc314
Comment options

camc314 Apr 24, 2026
Collaborator

@snebjorn
Comment options

@cookesan
Comment options

Answer selected by snebjorn
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants