File tree Expand file tree Collapse file tree 1 file changed +13
-1
lines changed Expand file tree Collapse file tree 1 file changed +13
-1
lines changed Original file line number Diff line number Diff line change @@ -156,10 +156,22 @@ export default defineNuxtModule<ModuleOptions>({
156156 )
157157
158158 if ( nuxt . options . _generate ) {
159- nuxt . hook ( 'nitro:config' , config => {
159+ nuxt . hook ( 'nitro:config' , async config => {
160160 config . prerender ||= { }
161161 config . prerender . routes ||= [ ]
162162 config . prerender . routes . push ( '/200.html' )
163+
164+ config . output ||= { }
165+ if ( ! config . output . publicDir ) {
166+ const distDir = resolve ( nuxt . options . rootDir , 'dist' )
167+ const stats = await fsp . lstat ( distDir ) . catch ( ( ) => null )
168+ if ( ! stats || ! stats . isSymbolicLink ( ) ) {
169+ config . output . publicDir = distDir
170+ if ( ! existsSync ( distDir ) ) {
171+ await fsp . mkdir ( distDir , { recursive : true } )
172+ }
173+ }
174+ }
163175 } )
164176
165177 // Ensure there is an index.html file present when doing static file generation
You can’t perform that action at this time.
0 commit comments