Workers – Use auxiliary Workers alongside full-stack frameworks

Workers – Use auxiliary Workers alongside full-stack frameworks

Auxiliary Workers are now fully supported when using full-stack frameworks, such as React Router and TanStack Start, that integrate with the Cloudflare Vite plugin. They are included alongside the framework’s build output in the build output directory. Note that this feature requires Vite 7 or above.

Auxiliary Workers are additional Workers that can be called via service bindings from your main (entry) Worker. They are defined in the plugin config, as in the example below:

import { defineConfig } from "vite";
import { tanstackStart } from "@tanstack/react-start/plugin/vite";
import { cloudflare } from "@cloudflare/vite-plugin";
export default defineConfig({
plugins: [
tanstackStart(),
cloudflare({
viteEnvironment: { name: "ssr" },
auxiliaryWorkers: [{ configPath: "./wrangler.aux.jsonc" }],
}),
],
});

See the Vite plugin API docs for more info.

Source: Cloudflare



Latest Posts

Pass It On
Leave a Comment

Comments

No comments yet. Why don’t you start the discussion?

Leave a Reply

Your email address will not be published. Required fields are marked *