Skip to content

Conversation

@ascorbic
Copy link
Contributor

@ascorbic ascorbic commented Nov 29, 2025

Summary

Adds documentation for the Vite plugin's upcoming config option. As well as documenting the option itself, I have added a guide explaining programmatic configuration in more detail. I've included changelogs for this as well as the related support for zero-config workers.

Code: cloudflare/workers-sdk#11445

Screenshots (optional)

Documentation checklist

@github-actions
Copy link
Contributor

This pull request requires reviews from CODEOWNERS as it changes files that match the following patterns:

Pattern Owners
/src/content/changelog/ @cloudflare/pm-changelogs, @cloudflare/pcx-technical-writing
/src/content/docs/workers/ @cloudflare/workers-docs, @GregBrimble, @irvinebroque, @mikenomitch, @korinne, @WalshyDev, @cloudflare/deploy-config, @cloudflare/pcx-technical-writing, @cloudflare/wrangler, @cloudflare/workers-runtime-1, @mattietk

export default defineConfig({
plugins: [
cloudflare({
configure: {
Copy link
Contributor

Choose a reason for hiding this comment

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

first time I read this I didn't quite follow:

  1. the relationship between the object you pass into configure and wrangler.jsonc (I can intuit it, but it didn't jump off the page to me)
  2. if configure could basically be passed anything from wrangler.jsonc or if it only supported a subset of values

I think I know with context from working on Workers what the answers to these are, but wonder if it's worth making extra explicit?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@irvinebroque good point. Added here 6e798b0

@ascorbic ascorbic requested a review from jamesopstad December 1, 2025 16:25
Copy link
Contributor

@jamesopstad jamesopstad left a comment

Choose a reason for hiding this comment

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

Really great documentation! Thanks @ascorbic.

Have approved but left a few minor comments to be resolved.


When using the [Cloudflare Vite plugin](/workers/vite-plugin/) to build and deploy Workers, a Wrangler configuration file is now optional for assets-only (static) sites. If no `wrangler.toml`, `wrangler.json`, or `wrangler.jsonc` file is found, the plugin generates sensible defaults for an assets-only site. The `name` is based on the `package.json` or the project directory name, and the `compatibility_date` uses the latest date supported by your installed Miniflare version.

This allows easier setup for static sites and Vite-based single-page applications (SPAs) that do not require custom Worker configuration. No newline at end of file
Copy link
Contributor

Choose a reason for hiding this comment

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

Should we add a note here that assets.not_found_handling still needs to be set to single-page-application for SPA? This is likely to trip people up otherwise.

import { WranglerConfig } from "~/components";

The Wrangler configuration file is optional when using the Cloudflare Vite plugin. Without one, the plugin uses default values. You can customize Worker configuration programmatically with the `config` option. This is useful when the Cloudflare plugin runs inside another plugin or framework.

Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
:::note
Configuration provided via the `config` option will not be included when running `wrangler types` or when running resource based Wrangler CLI commands such as `wrangler kv`, `wrangler d1` etc.
:::

I think we need something to this effect to discourage users from defining configuration this way by default.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Oh I actually wrote something but never committed it! I was wondering if it was worth saying how to manually add types, but I don't think we document that anywhere do we?

Copy link
Contributor

Choose a reason for hiding this comment

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

As discussed in chat, I don't think this is documented but it can be done via declaration merging.

@ascorbic ascorbic requested a review from jamesopstad December 2, 2025 14:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

8 participants