File tree Expand file tree Collapse file tree 1 file changed +8
-9
lines changed
packages/vite-plugin-cloudflare/src Expand file tree Collapse file tree 1 file changed +8
-9
lines changed Original file line number Diff line number Diff line change @@ -112,6 +112,14 @@ export function resolvePluginConfig(
112112 experimental : pluginConfig . experimental ?? { } ,
113113 } ;
114114 const root = userConfig . root ? path . resolve ( userConfig . root ) : process . cwd ( ) ;
115+ const buildTimeEnv = vite . loadEnv ( viteEnv . mode , root , [
116+ "CLOUDFLARE_" ,
117+ "WRANGLER_" ,
118+ ] ) ;
119+
120+ // Merge the loaded env variables into process.env so that they are available to
121+ // wrangler when it loads the worker configuration files.
122+ Object . assign ( process . env , buildTimeEnv ) ;
115123
116124 if ( viteEnv . isPreview ) {
117125 return {
@@ -122,15 +130,6 @@ export function resolvePluginConfig(
122130 }
123131
124132 const configPaths = new Set < string > ( ) ;
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 ) ;
133-
134133 const cloudflareEnv = buildTimeEnv . CLOUDFLARE_ENV ;
135134 const entryWorkerConfigPath = getValidatedWranglerConfigPath (
136135 root ,
You can’t perform that action at this time.
0 commit comments