Skip to content

Conversation

@dario-piotrowicz
Copy link
Member

Fixes https://jira.cfdata.org/browse/DEVX-2362 and https://jira.cfdata.org/browse/DEVX-2368

This PR updated the wrangler autoconfig logic in regards to Vite projects by:

  • installing and applying the Cloudflare vite plugin if not already present
  • using the usages of the Cloudflare vite plugin as a signal that the project is already configured for Cloudflare (given the recent zero-config changes to the vite plugin)

  • Tests
    • Tests included/updated
    • Tests not necessary because:
  • Public documentation
    • Cloudflare docs PR(s):
    • Documentation not necessary because: tracked elsewhere
  • Wrangler V3 Backport
    • Wrangler PR:
    • Not necessary because: autoconfig is not in v3

@changeset-bot
Copy link

changeset-bot bot commented Dec 3, 2025

🦋 Changeset detected

Latest commit: 698d855

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

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

@pkg-pr-new
Copy link

pkg-pr-new bot commented Dec 3, 2025

create-cloudflare

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

@cloudflare/kv-asset-handler

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

miniflare

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

@cloudflare/pages-shared

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

@cloudflare/unenv-preset

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

@cloudflare/vite-plugin

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

@cloudflare/vitest-pool-workers

npm i https://pkg.pr.new/@cloudflare/vitest-pool-workers@11508

@cloudflare/workers-editor-shared

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

@cloudflare/workers-utils

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

wrangler

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

commit: 698d855

@dario-piotrowicz dario-piotrowicz force-pushed the dario/DEVX-2362/autoconfig-vite-plugin-spas branch from da569ae to e8fda8d Compare December 3, 2025 12:40
return {
wranglerConfig: {
assets: {
directory: outputDir,
Copy link
Contributor

Choose a reason for hiding this comment

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

Does this add assets.directory to the Wrangler config? We try to actively discourage users from doing that as it's not necessary and the value is ignored.

Copy link
Member Author

Choose a reason for hiding this comment

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

Yes, that's what it does, ok thanks good to know 🙂👍

Copy link
Contributor

Choose a reason for hiding this comment

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

Thanks. I think what we will need for standard Vite projects is to set assets.not_found_handling to single-page-application.

Copy link
Member Author

Choose a reason for hiding this comment

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

Right, that's a good call, thanks! 👍

By the way, shall we check the docs for assets.directory? it looks like we include it here and there: https://developers.cloudflare.com/workers/static-assets/routing/single-page-application/#configuration

@dario-piotrowicz dario-piotrowicz marked this pull request as ready for review December 3, 2025 14:16
@dario-piotrowicz dario-piotrowicz requested a review from a team as a code owner December 3, 2025 14:16
@dario-piotrowicz dario-piotrowicz force-pushed the dario/DEVX-2362/autoconfig-vite-plugin-spas branch from a4d137e to c513178 Compare December 3, 2025 17:13
@dario-piotrowicz dario-piotrowicz force-pushed the dario/DEVX-2362/autoconfig-vite-plugin-spas branch from cfbe28c to f5fb88b Compare December 4, 2025 00:09
@github-project-automation github-project-automation bot moved this from Untriaged to Approved in workers-sdk Dec 4, 2025
Co-authored-by: Matt Kane <m@mk.gg>
@dario-piotrowicz dario-piotrowicz merged commit b17797c into main Dec 6, 2025
37 of 39 checks passed
@dario-piotrowicz dario-piotrowicz deleted the dario/DEVX-2362/autoconfig-vite-plugin-spas branch December 6, 2025 15:41
@github-project-automation github-project-automation bot moved this from Approved to Done in workers-sdk Dec 6, 2025
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.

4 participants