github cloudflare/workers-sdk @cloudflare/vite-plugin@1.16.0

latest releases: @cloudflare/workflows-shared@0.3.9, wrangler@4.52.0
4 hours ago

Minor Changes

  • #11445 c8e22c3 Thanks @ascorbic! - Allow Worker config to be customized in the plugin config

    The Vite plugin can now be used to generate a Worker configuration instead of needing a Wrangler config file, or to customize an existing user-provided configuration.

    This is done via a new config option on the plugin, which accepts either a partial Worker configuration object, or a function that receives the current configuration and returns a partial config object, or modifies the current config in place.

    import cloudflare from "@cloudflare/vite-plugin";
    import { defineConfig } from "vite";
    
    // Define a partial config object
    
    export default defineConfig({
    	plugins: [
    		cloudflare({
    			config: {
    				compatibility_date: "2025-01-01",
    			},
    		}),
    	],
    });
    
    // Return a partial config from a function, conditional on some logic
    
    export default defineConfig({
    	plugins: [
    		cloudflare({
    			config: (workerConfig) => {
    				if (workerConfig.name === "my-worker") {
    					return {
    						compatibility_flags: ["nodejs_compat"],
    					};
    				}
    			},
    		}),
    	],
    });
    
    // Modify the config in place
    
    export default defineConfig({
    	plugins: [
    		cloudflare({
    			config: (workerConfig) => {
    				workerConfig.compatibility_date = "2025-01-01";
    			},
    		}),
    	],
    });
  • #11360 6b38532 Thanks @emily-shen! - Containers: Allow users to directly authenticate external image registries in local dev

    Previously, we always queried the API for stored registry credentials and used those to pull images. This means that if you are using an external registry (ECR, dockerhub) then you have to configure registry credentials remotely before running local dev.

    Now you can directly authenticate with your external registry provider (using docker login etc.), and Wrangler or Vite will be able to pull the image specified in the containers.image field in your config file.

    The Cloudflare-managed registry (registry.cloudflare.com) currently still does not work with the Vite plugin.

  • #11408 f29e699 Thanks @ascorbic! - Support zero-config operation

    If the Vite plugin is used in a project without an existing Wrangler config file, it should be able to operate in "zero-config" mode by generating a default Wrangler configuration for an assets-only worker.

  • #11417 2ca70b1 Thanks @jamesopstad! - Register named entrypoints with the dev registry.

    This enables binding to named entrypoints defined in a vite dev session from another vite dev or wrangler dev session running locally.

Patch Changes

  • #11383 1d685cb Thanks @dario-piotrowicz! - Fix: Ensure that vite dev and vite preview hard error with an appropriate error message when a remote proxy session is required but if the connection with it fails to be established

    When using remote bindings, either with vite dev or vite preview, the remote proxy session necessary to connect to the remote resources can fail to be created. This might happen if for example you try to set a binding with some invalid values such as:

    MY_R2: {
    	type: "r2_bucket",
    	bucket_name: "non-existent", // No bucket called "non-existent" exists
    	remote: true,
    },

    Before, this could go undetected and cause unwanted behaviors such as requests handling hanging indefinitely. Now, a hard error will be thrown instead causing the vite process to crash, clearly indicating that something went wrong during the remote session's creation.

  • #11009 e4ddbc2 Thanks @dario-piotrowicz! - Make sure that the account_id present in the user's config file is used for remote bindings

  • Updated dependencies [2b4813b, abe49d8, b154de2, f29e699, 5ee3780, 6e63b57, 71ab562, 76f0540, 2342d2f, 5e937c1, 9a1de61, 6b38532, e4ddbc2, 2aec2b4, 695fa25, 504e258, 5a873bb, d25f7e2, 1cfae2d, e7b690b, 1d685cb, edf896d, 2b4813b, c47ad11, a977701, 9eaa9e2]:

    • miniflare@4.20251128.0
    • wrangler@4.52.0
    • @cloudflare/unenv-preset@2.7.12

Don't miss a new workers-sdk release

NewReleases is sending notifications on new releases.