@@ -53,19 +53,22 @@ export async function loadFixture() {
5353 } )
5454 }
5555
56- ctx . nuxt = await kit . loadNuxt ( {
57- cwd : ctx . options . rootDir ,
58- dev : ctx . options . dev ,
59- overrides : ctx . options . nuxtConfig ,
60- configFile : ctx . options . configFile ,
61- } )
56+ // TODO: share Nuxt instance with running Nuxt if possible
57+ if ( ctx . options . build ) {
58+ ctx . nuxt = await kit . loadNuxt ( {
59+ cwd : ctx . options . rootDir ,
60+ dev : ctx . options . dev ,
61+ overrides : ctx . options . nuxtConfig ,
62+ configFile : ctx . options . configFile ,
63+ } )
6264
63- const buildDir = ctx . nuxt . options . buildDir
64- // avoid creating / deleting build dirs that already exist - avoids misconfiguration deletes
65- if ( ! existsSync ( buildDir ) ) {
66- await fsp . mkdir ( buildDir , { recursive : true } )
67- ctx . teardown = ctx . teardown || [ ]
68- ctx . teardown . push ( ( ) => fsp . rm ( buildDir , { recursive : true , force : true } ) )
65+ const buildDir = ctx . nuxt . options . buildDir
66+ // avoid creating / deleting build dirs that already exist - avoids misconfiguration deletes
67+ if ( ! existsSync ( buildDir ) ) {
68+ await fsp . mkdir ( buildDir , { recursive : true } )
69+ ctx . teardown = ctx . teardown || [ ]
70+ ctx . teardown . push ( ( ) => fsp . rm ( buildDir , { recursive : true , force : true } ) )
71+ }
6972 }
7073}
7174
0 commit comments