Skip to content

[wrangler] Upload source maps by default - #16231

Merged
petebacondarwin merged 1 commit into
mainfrom
walshy/default-upload-source-maps
Oct 13, 2026
Merged

petebacondarwin merged 1 commit into
mainfrom
walshy/default-upload-source-maps

Conversation

@WalshyDev

@WalshyDev WalshyDev commented Oct 12, 2026 •

Copy link
Copy Markdown
Member

Fixes #[insert GH or internal issue link(s)].

upload_source_maps now defaults to on for wrangler deploy, wrangler versions upload and wrangler preview when it isn't set in config or via --upload-source-maps, so stack traces point at original source without extra setup. wrangler build --experimental-cf-build-output keeps its opt-in behaviour.

When defaulted, source maps that can't be resolved (inline data: maps, missing .map files from custom builds) are skipped with a debug log instead of failing the upload, so existing prebuilt Workers keep deploying. An explicit upload_source_maps = true keeps the strict errors, and false / --no-upload-source-maps opts out.

Also fixes Wrangler-bundled source map path resolution on Windows when --outdir is on a different drive; esbuild reports an absolute path there, which was previously joined onto the entry directory.


@changeset-bot

changeset-bot Bot commented Oct 12, 2026 •

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: fa5e9cf

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 Patch
@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

@ask-bonk

ask-bonk Bot commented Oct 12, 2026

Copy link
Copy Markdown
Contributor

P2: Preserve the opt-in behavior of other buildWorker consumers.

The new undefined default applies to Preview and wrangler build --experimental-cf-build-output too, although this PR only scopes the default to deploy and versions upload. Preview therefore uploads maps without configuration, while Build Output emits map modules even though it does not upload a Worker.

packages/wrangler/src/preview/preview.ts:110

				uploadSourceMaps: previewConfig.upload_source_maps ?? false,

packages/wrangler/src/deployment-bundle/merge-config-args.ts:256

		uploadSourceMaps: config.upload_source_maps ?? false,

@ask-bonk

ask-bonk Bot commented Oct 12, 2026

Copy link
Copy Markdown
Contributor

I'm Bonk, and I've done a quick review of your PR.

Defaults source-map generation and uploads for deploys and versions uploads.

  1. P2: The shared default also changes Preview and experimental Build Output behavior. Posted a suggestion comment covering both call sites.

github run

@pkg-pr-new

pkg-pr-new Bot commented Oct 12, 2026 •

Copy link
Copy Markdown
@cloudflare/autoconfig

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

@cloudflare/build-output-utils

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

@cloudflare/codemods

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

@cloudflare/config

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

@cloudflare/containers-shared

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

create-cloudflare

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

@cloudflare/deploy-helpers

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

@cloudflare/kv-asset-handler

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

miniflare

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

@cloudflare/pages-functions

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

@cloudflare/pages-shared

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

@cloudflare/runtime-types

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

@cloudflare/unenv-preset

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

@cloudflare/vite-plugin

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

@cloudflare/vitest-plugin

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

@cloudflare/workers-auth

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

@cloudflare/workers-editor-shared

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

@cloudflare/workers-utils

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

wrangler

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

commit: fa5e9cf

@WalshyDev
WalshyDev force-pushed the walshy/default-upload-source-maps branch from 0478c2c to eb976df Compare October 13, 2026 00:42
@WalshyDev
WalshyDev marked this pull request as ready for review October 13, 2026 00:59
@WalshyDev
WalshyDev force-pushed the walshy/default-upload-source-maps branch from eb976df to 83dc0c3 Compare October 13, 2026 00:59
@workers-devprod
workers-devprod requested review from a team and petebacondarwin and removed request for a team October 13, 2026 01:00
@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[bot]

This comment was marked as resolved.

@WalshyDev
WalshyDev force-pushed the walshy/default-upload-source-maps branch from 83dc0c3 to 32c878a Compare October 13, 2026 01:04
`upload_source_maps` now defaults to on for `wrangler deploy`,
`wrangler versions upload` and `wrangler preview` when it isn't set in
config or via `--upload-source-maps`, so stack traces point at original
source without extra setup. `wrangler build
--experimental-cf-build-output` keeps its opt-in behaviour.

When defaulted, source maps that can't be resolved (inline `data:` maps,
missing `.map` files from custom builds) are skipped with a debug log
instead of failing the upload, so existing prebuilt Workers keep
deploying. An explicit `upload_source_maps = true` keeps the strict
errors, and `false` / `--no-upload-source-maps` opts out.

Also resolve Wrangler-bundled source map paths with `path.resolve`, as
esbuild reports an absolute output path when `--outdir` is on a different
Windows drive, which previously produced an invalid joined path.
@petebacondarwin
petebacondarwin enabled auto-merge (squash) October 13, 2026 06:40

@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
@petebacondarwin
petebacondarwin merged commit 091e5ec into main Oct 13, 2026
96 of 99 checks passed
@petebacondarwin
petebacondarwin deleted the walshy/default-upload-source-maps branch October 13, 2026 06:41
@github-project-automation github-project-automation Bot moved this from Approved to Done in workers-sdk Oct 13, 2026
WalshyDev added a commit to cloudflare/cloudflare-docs that referenced this pull request Oct 13, 2026
Wrangler now generates and uploads source maps by default for
`wrangler deploy`, `wrangler versions upload` and `wrangler preview`
(cloudflare/workers-sdk#16231). Update the source maps and configuration
docs to describe the new default, the lenient handling of unresolvable
maps, and how to opt out, and add a changelog entry announcing it.
brandhaug added a commit to brandhaug/b2b-saas-starter that referenced this pull request Oct 16, 2026
## pnpm-workspace.yaml (default)

## Dependency Updates

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

## Release Notes

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

### Minor Changes

- [#16231](cloudflare/workers-sdk#16231)
[`091e5ec`](cloudflare/workers-sdk@091e5ec)
Thanks [@<!---->WalshyDev](https://github.com/WalshyDev)! - Upload
source maps by default for `wrangler deploy`, `wrangler versions upload`
and `wrangler preview`

When `upload_source_maps` isn't set in config or via
`--upload-source-maps`, Wrangler now generates and uploads source maps
so stack traces in logs and `wrangler tail` point at your original
source without extra setup. In this default mode, source maps that can't
be resolved (for example inline `data:` maps or missing `.map` files
from a custom build) are skipped rather than failing the upload. Setting
`upload_source_maps = true` keeps the existing strict behaviour, and
`upload_source_maps = false` (or `--no-upload-source-maps` for deploy
and versions upload) opts out.

`wrangler build --experimental-cf-build-output` is unchanged and still
only includes source maps when `upload_source_maps = true`.

- [#16128](cloudflare/workers-sdk#16128)
[`daae435`](cloudflare/workers-sdk@daae435)
Thanks [@<!---->redsteadz](https://github.com/redsteadz)! - Stop
`wrangler deploy`, `wrangler versions upload` and `wrangler preview` in
projects that build for the Cloudflare CLI (`cf`)

If your project builds through `cf`, deploying it with Wrangler reads a
different configuration, so it could update the wrong Worker or fail
without explaining why. These commands now stop before uploading
anything, name the `.cloudflare/output` directory they found, and tell
you to run `cf deploy` instead. If that directory is just left over from
an earlier build, deleting it restores the Wrangler workflow.

Ordinary Wrangler projects are unaffected, and `--dry-run` still works
on `deploy` and `versions upload`. This is a new guard for the
experimental Build Output Specification rat

…[full
notes](https://github.com/cloudflare/workers-sdk/releases/tag/wrangler%404.150.0)

</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