mirror of
https://github.com/nuxt/nuxt.git
synced 2025-01-18 17:35:57 +00:00
fix(nitro): do not overwrite output files for browser-preset (#516)
This commit is contained in:
parent
7936329646
commit
b47c592e39
@ -1,4 +1,4 @@
|
||||
import { writeFile } from 'fs-extra'
|
||||
import { existsSync, writeFile } from 'fs-extra'
|
||||
import { resolve } from 'upath'
|
||||
import consola from 'consola'
|
||||
import { extendPreset, prettyPath } from '../utils'
|
||||
@ -68,10 +68,15 @@ if ('serviceWorker' in navigator) {
|
||||
await writeFile(resolve(output.publicDir, 'sw.js'), `self.importScripts('${input._nuxt.routerBase}_server/index.mjs');`)
|
||||
|
||||
// Temp fix
|
||||
await writeFile(resolve(output.publicDir, 'index.html'), html)
|
||||
await writeFile(resolve(output.publicDir, '200.html'), html)
|
||||
await writeFile(resolve(output.publicDir, '404.html'), html)
|
||||
|
||||
if (!existsSync(resolve(output.publicDir, 'index.html'))) {
|
||||
await writeFile(resolve(output.publicDir, 'index.html'), html)
|
||||
}
|
||||
if (!existsSync(resolve(output.publicDir, '200.html'))) {
|
||||
await writeFile(resolve(output.publicDir, '200.html'), html)
|
||||
}
|
||||
if (!existsSync(resolve(output.publicDir, '404.html'))) {
|
||||
await writeFile(resolve(output.publicDir, '404.html'), html)
|
||||
}
|
||||
consola.info('Ready to deploy to static hosting:', prettyPath(output.publicDir as string))
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user