Skip to content

Generate source maps by default for Vite plugin Workers and Build Output - #16245

Merged
WalshyDev merged 2 commits into
mainfrom
walshy/build-output-source-maps
Oct 13, 2026
Merged

WalshyDev merged 2 commits into
mainfrom
walshy/build-output-source-maps

Conversation

@WalshyDev

@WalshyDev WalshyDev commented Oct 13, 2026 •

Copy link
Copy Markdown
Member

Follow-up to #16231, which turned source map uploads on by default for wrangler deploy, wrangler versions upload and wrangler preview. Two build paths still don't produce source maps by default, so there's nothing to upload from them. One of those is the path cf uses.

  • Vite plugin: Vite leaves build.sourcemap off by default, so Worker builds never emitted maps. Worker environments now default it to true unless the user sets build.sourcemap (per environment or at the top level) or sets upload_source_maps in the Worker config. The client environment isn't affected, so no maps end up in public assets.
  • wrangler build --experimental-cf-build-output (and the cf-wrangler build delegate): only included source maps when upload_source_maps = true. It now uses the same default as deploy. Maps it can't resolve are skipped instead of failing the build, and upload_source_maps = false opts out.

  • Tests
    • Tests included/updated
    • Automated tests not possible - manual testing has been completed as follows:
    • Additional testing not necessary because:
  • Public documentation
    • Cloudflare docs PR(s):
    • Documentation not necessary because: existing docs that enable build.sourcemap explicitly are still correct; they can be simplified in a follow-up

Devin Review

`wrangler build --experimental-cf-build-output` (and the `cf-wrangler` build delegate used by `cf`) only emitted source maps when `upload_source_maps = true`. It now uses the same best-effort default as `wrangler deploy` and `wrangler versions upload`: source maps are generated and listed in the Build Output manifest, unresolvable ones are skipped, and `upload_source_maps = false` opts out.
Vite leaves `build.sourcemap` off by default, so Worker builds never emitted source maps and neither Build Output nor the generated `wrangler.json` had any to upload. Worker environments now default `build.sourcemap` to `true` unless the user sets it (per-environment or top-level) or sets `upload_source_maps` in the Worker config. Only Worker environments are affected, so no source maps end up in public client assets.
@changeset-bot

changeset-bot Bot commented Oct 13, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 5d108f6

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 3 packages
Name Type
wrangler Minor
@cloudflare/vite-plugin Minor
@cloudflare/vitest-plugin Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@github-project-automation github-project-automation Bot moved this to Untriaged in workers-sdk Oct 13, 2026
@workers-devprod
workers-devprod requested review from a team and jamesopstad and removed request for a team October 13, 2026 15:46
@workers-devprod

workers-devprod commented Oct 13, 2026 •

Copy link
Copy Markdown
Contributor

Codeowners approval required for this PR:

  • ✅ @cloudflare/wrangler
Show detailed file reviewers

@devin-ai-integration devin-ai-integration Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ Devin Review: No Issues Found

Devin Review analyzed this PR and found no bugs or issues to report.

Devin Review

@pkg-pr-new

pkg-pr-new Bot commented Oct 13, 2026

Copy link
Copy Markdown
@cloudflare/autoconfig

npm i https://pkg.pr.new/@cloudflare/autoconfig@16245

@cloudflare/build-output-utils

npm i https://pkg.pr.new/@cloudflare/build-output-utils@16245

@cloudflare/codemods

npm i https://pkg.pr.new/@cloudflare/codemods@16245

@cloudflare/config

npm i https://pkg.pr.new/@cloudflare/config@16245

@cloudflare/containers-shared

npm i https://pkg.pr.new/@cloudflare/containers-shared@16245

create-cloudflare

npm i https://pkg.pr.new/create-cloudflare@16245

@cloudflare/deploy-helpers

npm i https://pkg.pr.new/@cloudflare/deploy-helpers@16245

@cloudflare/kv-asset-handler

npm i https://pkg.pr.new/@cloudflare/kv-asset-handler@16245

miniflare

npm i https://pkg.pr.new/miniflare@16245

@cloudflare/pages-functions

npm i https://pkg.pr.new/@cloudflare/pages-functions@16245

@cloudflare/pages-shared

npm i https://pkg.pr.new/@cloudflare/pages-shared@16245

@cloudflare/runtime-types

npm i https://pkg.pr.new/@cloudflare/runtime-types@16245

@cloudflare/unenv-preset

npm i https://pkg.pr.new/@cloudflare/unenv-preset@16245

@cloudflare/vite-plugin

npm i https://pkg.pr.new/@cloudflare/vite-plugin@16245

@cloudflare/vitest-plugin

npm i https://pkg.pr.new/@cloudflare/vitest-plugin@16245

@cloudflare/workers-auth

npm i https://pkg.pr.new/@cloudflare/workers-auth@16245

@cloudflare/workers-editor-shared

npm i https://pkg.pr.new/@cloudflare/workers-editor-shared@16245

@cloudflare/workers-utils

npm i https://pkg.pr.new/@cloudflare/workers-utils@16245

wrangler

npm i https://pkg.pr.new/wrangler@16245

commit: 5d108f6

@ask-bonk

ask-bonk Bot commented Oct 13, 2026

Copy link
Copy Markdown
Contributor

LGTM!

github run

@dario-piotrowicz
dario-piotrowicz requested review from dario-piotrowicz and removed request for jamesopstad October 13, 2026 15:51

@workers-devprod workers-devprod left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Codeowners reviews satisfied

@github-project-automation github-project-automation Bot moved this from Untriaged to Approved in workers-sdk Oct 13, 2026
@WalshyDev
WalshyDev enabled auto-merge (squash) October 13, 2026 16:06
@WalshyDev
WalshyDev merged commit d6b1c82 into main Oct 13, 2026
96 of 98 checks passed
@WalshyDev
WalshyDev deleted the walshy/build-output-source-maps branch October 13, 2026 16:06
@github-project-automation github-project-automation Bot moved this from Approved to Done in workers-sdk Oct 13, 2026
brandhaug added a commit to brandhaug/b2b-saas-starter that referenced this pull request Oct 17, 2026
## pnpm-workspace.yaml (default)

## Dependency Updates

| Package | From | To | Type |
| --- | --- | --- | --- |
| `wrangler` | 4.150.0 | 4.151.0 | minor |

## Release Notes

<details>
<summary><b>wrangler</b> (4.150.0 → 4.151.0)</summary>

### Minor Changes

- [#16245](cloudflare/workers-sdk#16245)
[`d6b1c82`](cloudflare/workers-sdk@d6b1c82)
Thanks [@<!---->WalshyDev](https://github.com/WalshyDev)! - Include
source maps by default in `wrangler build
--experimental-cf-build-output`

Build Output now matches `wrangler deploy` and `wrangler versions
upload`, which upload source maps by default, so Workers built for tools
like `cf` get stack traces that point at the original source. Source
maps that can't be resolved are skipped rather than failing the build.
Set `upload_source_maps = false` to opt out.

### Patch Changes

- [#16220](cloudflare/workers-sdk#16220)
[`97b2fb1`](cloudflare/workers-sdk@97b2fb1)
Thanks [@<!---->FlorentCollin](https://github.com/FlorentCollin)! -
Support local D1 queries through the experimental `d1_binding_jsrpc`
compatibility flag

Local D1 bindings now implement the RPC query backend used by
`D1Database.query()` and prepared-statement methods when the flag is
enabled. Queries reuse local SQLite execution, including transactional
batches, execution metadata, and session bookmarks, while bindings
without the flag continue to use HTTP. Update the bundled workerd
runtime to `1.20261012.1` and align the default compatibility date with
that release.

- Updated dependencies
[[`f360829`](cloudflare/workers-sdk@f360829),
[`97b2fb1`](cloudflare/workers-sdk@97b2fb1),
[`97b2fb1`](cloudflare/workers-sdk@97b2fb1),
[`acd2822`](cloudflare/workers-sdk@acd2822)]:
  - miniflare@5.20261012.0-beta

</details>

---
*This PR was auto-generated by
[catalog-update-action](https://github.com/brandhaug/catalog-update-action).*

Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
WalshyDev added a commit to cloudflare/cloudflare-docs that referenced this pull request Oct 19, 2026
Wrangler now generates and uploads source maps by default for
`wrangler deploy`, `wrangler versions upload` and `wrangler preview`
(cloudflare/workers-sdk#16231). The Cloudflare Vite plugin and Wrangler's
Build Output now also generate source maps by default
(cloudflare/workers-sdk#16245), so `cf deploy`, which uploads every source
map in the build output, gets them without configuration too.

Update the source maps, configuration and cf migration docs to describe
the new defaults, the lenient handling of unresolvable maps, and how to
opt out with Wrangler and with cf, and add a changelog entry announcing it.
WalshyDev added a commit to cloudflare/cloudflare-docs that referenced this pull request Oct 19, 2026
Wrangler now generates and uploads source maps by default for
`wrangler deploy`, `wrangler versions upload` and `wrangler preview`
(cloudflare/workers-sdk#16231). The Cloudflare Vite plugin and Wrangler's
Build Output now also generate source maps by default
(cloudflare/workers-sdk#16245), so `cf deploy`, which uploads every source
map in the build output, gets them without configuration too.

Update the source maps, configuration and cf migration docs to describe
the new defaults, the lenient handling of unresolvable maps, and how to
opt out with Wrangler and with cf, and add a changelog entry announcing it.
WalshyDev added a commit to cloudflare/cloudflare-docs that referenced this pull request Oct 19, 2026
Wrangler now generates and uploads source maps by default for
`wrangler deploy`, `wrangler versions upload` and `wrangler preview`
(cloudflare/workers-sdk#16231). The Cloudflare Vite plugin and Wrangler's
Build Output now also generate source maps by default
(cloudflare/workers-sdk#16245), so `cf deploy`, which uploads every source
map in the build output, gets them without configuration too.

Update the source maps, configuration and cf migration docs to describe
the new defaults, the lenient handling of unresolvable maps, and how to
opt out with Wrangler and with cf, and add a changelog entry announcing it.
WalshyDev added a commit to cloudflare/cloudflare-docs that referenced this pull request Oct 20, 2026
Wrangler now generates and uploads source maps by default for
`wrangler deploy`, `wrangler versions upload` and `wrangler preview`
(cloudflare/workers-sdk#16231). The Cloudflare Vite plugin and Wrangler's
Build Output now also generate source maps by default
(cloudflare/workers-sdk#16245), so `cf deploy`, which uploads every source
map in the build output, gets them without configuration too.

Update the source maps, configuration and cf migration docs to describe
the new defaults, the lenient handling of unresolvable maps, and how to
opt out with Wrangler and with cf, and add a changelog entry announcing it.
meefs pushed a commit to meefs/cloudflare-docs that referenced this pull request Oct 21, 2026
…34245)

Wrangler now generates and uploads source maps by default for
`wrangler deploy`, `wrangler versions upload` and `wrangler preview`
(cloudflare/workers-sdk#16231). The Cloudflare Vite plugin and Wrangler's
Build Output now also generate source maps by default
(cloudflare/workers-sdk#16245), so `cf deploy`, which uploads every source
map in the build output, gets them without configuration too.

Update the source maps, configuration and cf migration docs to describe
the new defaults, the lenient handling of unresolvable maps, and how to
opt out with Wrangler and with cf, and add a changelog entry announcing it.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

3 participants