File tree Expand file tree Collapse file tree 2 files changed +19
-9
lines changed Expand file tree Collapse file tree 2 files changed +19
-9
lines changed Original file line number Diff line number Diff line change 11// https://nuxt.com/docs/api/configuration/nuxt-config
22export default defineNuxtConfig ( {
33 devtools : { enabled : true } ,
4- // uncomment to enable the plugin
5- // modules: [
6- // ['~/../../../src/nuxt', {
7- // enabled: true,
8- // target: 'test-nuxt.abc.com',
9- // }],
10- // ],
4+ modules : [
5+ [ '~/../../../src/nuxt' , {
6+ enabled : true ,
7+ target : 'test-nuxt.abc.com' ,
8+ } ] ,
9+ ] ,
1110} )
Original file line number Diff line number Diff line change @@ -105,7 +105,14 @@ interface RunOptions {
105105 health_check ?: boolean
106106}
107107
108- const { cleanUp, configJsonRef, writeCaddyConfig } = useCaddyConfig ( )
108+ let caddyConfig : ReturnType < typeof useCaddyConfig > | undefined
109+
110+ function getCaddyConfig ( ) : ReturnType < typeof useCaddyConfig > {
111+ if ( ! caddyConfig ) {
112+ caddyConfig = useCaddyConfig ( )
113+ }
114+ return caddyConfig
115+ }
109116
110117export class CaddyInstant {
111118 private inited = false
@@ -204,10 +211,12 @@ export class CaddyInstant {
204211 } ,
205212 ]
206213
214+ const { writeCaddyConfig } = getCaddyConfig ( )
207215 writeCaddyConfig ( proxies )
208216
209217 this . _stopEffects . push (
210218 effect ( async ( ) => {
219+ const { configJsonRef } = getCaddyConfig ( )
211220 const proxies = Object . values ( configJsonRef ( ) || { } )
212221 if ( ! ( this . caddyfile || '' ) . includes ( `${ target . split ( ':' ) [ 0 ] } ${ https ? '' : ':80' } ` ) ) {
213222 const ctx = validateTemplateContext ( {
@@ -368,7 +377,9 @@ export class CaddyInstant {
368377 await lockfile . unlock ( caddyLockFilePath ) . catch ( ( ) => { } )
369378 await unlink ( caddyFilePath ) . catch ( ( ) => { } )
370379 await unlink ( caddyLockFilePath ) . catch ( ( ) => { } )
371- await cleanUp ( )
380+ if ( caddyConfig ) {
381+ await caddyConfig . cleanUp ( )
382+ }
372383 }
373384 catch ( e ) {
374385 consola . error ( e )
You can’t perform that action at this time.
0 commit comments