File tree Expand file tree Collapse file tree 3 files changed +11
-6
lines changed
Expand file tree Collapse file tree 3 files changed +11
-6
lines changed Original file line number Diff line number Diff line change 22export default defineNuxtConfig ( {
33 modules : [ "nitro-cloudflare-dev" ] ,
44 compatibilityDate : "2024-10-10" ,
5- } ) ;
5+ } ) ;
Original file line number Diff line number Diff line change @@ -90,7 +90,7 @@ async function nitroModule(nitro: Nitro) {
9090// Dual compatibility with Nuxt and Nitro Modules
9191export default function nitroCloudflareDev ( arg1 : unknown , arg2 : unknown ) {
9292 if ( ( arg2 as Nuxt ) ?. options ?. nitro ) {
93- ( arg2 as Nuxt ) . hooks . hook ( "nitro:config" , ( nitroConfig ) => {
93+ ( arg2 as Nuxt ) . hooks . hookOnce ( "nitro:config" , ( nitroConfig ) => {
9494 nitroConfig . modules = nitroConfig . modules || [ ] ;
9595 nitroConfig . modules . push ( nitroModule ) ;
9696 } ) ;
Original file line number Diff line number Diff line change 11import type { NitroAppPlugin } from "nitropack" ;
2- import type { PlatformProxy } from "wrangler" ;
2+ import type { GetPlatformProxyOptions , PlatformProxy } from "wrangler" ;
33// @ts -ignore
44import { useRuntimeConfig , getRequestURL } from "#imports" ;
55
@@ -71,11 +71,16 @@ async function _getPlatformProxy() {
7171 } ;
7272 } = useRuntimeConfig ( ) ;
7373
74- const proxy = await getPlatformProxy ( {
74+ const proxyOptions : GetPlatformProxyOptions = {
7575 configPath : runtimeConfig . wrangler . configPath ,
7676 persist : { path : runtimeConfig . wrangler . persistDir } ,
77- environment : runtimeConfig . wrangler . environment ,
78- } ) ;
77+ } ;
78+ // TODO: investigate why
79+ // https://github.com/pi0/nitro-cloudflare-dev/issues/51
80+ if ( runtimeConfig . wrangler . environment ) {
81+ proxyOptions . environment = runtimeConfig . wrangler . environment ;
82+ }
83+ const proxy = await getPlatformProxy ( proxyOptions ) ;
7984
8085 return proxy ;
8186}
You can’t perform that action at this time.
0 commit comments