mirror of
https://github.com/nuxt/nuxt.git
synced 2024-11-21 21:25:11 +00:00
build(ui-templates): directly copy templates on build (#27430)
This commit is contained in:
parent
b788170018
commit
b6d797591d
6
packages/nuxt/.gitignore
vendored
Normal file
6
packages/nuxt/.gitignore
vendored
Normal file
@ -0,0 +1,6 @@
|
||||
src/app/components/error-404.vue
|
||||
src/app/components/error-500.vue
|
||||
src/app/components/error-dev.vue
|
||||
src/app/components/welcome.vue
|
||||
src/core/runtime/nitro/error-500.ts
|
||||
src/core/runtime/nitro/error-dev.ts
|
@ -1 +0,0 @@
|
||||
../../../../ui-templates/dist/templates/error-404.vue
|
@ -1 +0,0 @@
|
||||
../../../../ui-templates/dist/templates/error-500.vue
|
@ -1 +0,0 @@
|
||||
../../../../ui-templates/dist/templates/error-dev.vue
|
@ -1 +0,0 @@
|
||||
../../../../ui-templates/dist/templates/welcome.vue
|
@ -1 +0,0 @@
|
||||
../../../../../ui-templates/dist/templates/error-500.ts
|
@ -1 +0,0 @@
|
||||
../../../../../ui-templates/dist/templates/error-dev.ts
|
@ -1,5 +1,6 @@
|
||||
import { fileURLToPath } from 'node:url'
|
||||
import { readFileSync, rmdirSync, unlinkSync, writeFileSync } from 'node:fs'
|
||||
import { copyFile } from 'node:fs/promises'
|
||||
import { basename, dirname, join, resolve } from 'pathe'
|
||||
import type { Plugin } from 'vite'
|
||||
// @ts-expect-error https://github.com/GoogleChromeLabs/critters/pull/151
|
||||
@ -167,6 +168,15 @@ export const RenderPlugin = () => {
|
||||
unlinkSync(fileName)
|
||||
rmdirSync(dirname(fileName))
|
||||
}
|
||||
|
||||
// we manually copy files across rather than using symbolic links for better windows support
|
||||
const nuxtRoot = r('../nuxt')
|
||||
for (const file of ['error-404.vue', 'error-500.vue', 'error-dev.vue', 'welcome.vue']) {
|
||||
await copyFile(r(`dist/templates/${file}`), join(nuxtRoot, 'src/app/components', file))
|
||||
}
|
||||
for (const file of ['error-500.ts', 'error-dev.ts']) {
|
||||
await copyFile(r(`dist/templates/${file}`), join(nuxtRoot, 'src/core/runtime/nitro', file))
|
||||
}
|
||||
},
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user