How to deploy Storybook with Vite on Cloudflare Workers? #32293
-
SummaryI'd like to deploy Storybook build on Cloudflare Workers. I couldn't find any example repos or guides. Cloudflare's Vite plugin causes Storybook to throw error on build and dev. Looks like Cloudflare team already addressed some related issues but it's not working at all. Additional information
Create a reproductionNo response |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments
-
|
Hi @kpyszkowski! I'm Dosu and I’m helping the storybook team. There aren't any official guides or example repos for deploying Storybook with Vite on Cloudflare Workers. The error you're seeing— Storybook's Vite builder merges your Vite config automatically, but you can customize or remove problematic plugins using the export default {
// ...other config
async viteFinal(config) {
// Remove Cloudflare plugin if present
config.plugins = (config.plugins || []).filter(
(plugin) => plugin?.name !== 'cloudflare'
);
return config;
},
};For deployment, the typical approach is to run If you need the Cloudflare Vite plugin for your main app, consider conditionally including it only when not running Storybook. There are no known workarounds for using the plugin directly with Storybook's Vite builder at this time. To reply, just mention @dosu. How did I do? Good | Irrelevant | Incorrect | Verbose | Hallucination | Report 🐛 | Other |
Beta Was this translation helpful? Give feedback.
-
|
It can be done without touching Cloudflare's Vite plugin. Storybook builds static HTML and it can be served as usual static content.
|
Beta Was this translation helpful? Give feedback.
It can be done without touching Cloudflare's Vite plugin. Storybook builds static HTML and it can be served as usual static content.
The only significant change is worker entry point which points requests to assets bucket. I placed it in
.storybookbut can be anywhere:.storybook/worker.js:wrangler.jsonc:{ "name": "storybook", // can be any "compatibility_date": "2025-08-18", "assets": { "directory": "./storybook-static", // default build output directory "binding": "ASSETS", }, "main": "./.storybook/worker.js", // worker entry point }