File tree Expand file tree Collapse file tree 1 file changed +9
-5
lines changed
packages/vite-plugin-cloudflare/src Expand file tree Collapse file tree 1 file changed +9
-5
lines changed Original file line number Diff line number Diff line change @@ -122,12 +122,16 @@ export function resolvePluginConfig(
122122 }
123123
124124 const configPaths = new Set < string > ( ) ;
125- const { CLOUDFLARE_ENV : cloudflareEnv } = vite . loadEnv (
126- viteEnv . mode ,
127- root ,
128- /* prefixes */ ""
129- ) ;
125+ const buildTimeEnv = vite . loadEnv ( viteEnv . mode , root , [
126+ "CLOUDFLARE_" ,
127+ "WRANGLER_" ,
128+ ] ) ;
129+
130+ // Merge the loaded env variables into process.env so that they are available to
131+ // wrangler when it loads the worker configuration files.
132+ Object . assign ( process . env , buildTimeEnv ) ;
130133
134+ const cloudflareEnv = buildTimeEnv . CLOUDFLARE_ENV ;
131135 const entryWorkerConfigPath = getValidatedWranglerConfigPath (
132136 root ,
133137 pluginConfig . configPath
You can’t perform that action at this time.
0 commit comments