mirror of
https://github.com/nuxt/nuxt.git
synced 2024-11-11 00:23:53 +00:00
fix(schema): handle dev/test buildId
in schema (#27274)
This commit is contained in:
parent
1ce1a55a87
commit
a1c184a288
@ -218,8 +218,7 @@ export async function initNitro (nuxt: Nuxt & { _nitro?: Nitro }) {
|
||||
|
||||
// Add app manifest handler and prerender configuration
|
||||
if (nuxt.options.experimental.appManifest) {
|
||||
const buildId = nuxt.options.runtimeConfig.app.buildId ||=
|
||||
(nuxt.options.dev ? 'dev' : nuxt.options.test ? 'test' : nuxt.options.buildId)
|
||||
const buildId = nuxt.options.runtimeConfig.app.buildId ||= nuxt.options.buildId
|
||||
const buildTimestamp = Date.now()
|
||||
|
||||
const manifestPrefix = joinURL(nuxt.options.app.buildAssetsDir, 'builds')
|
||||
|
@ -165,7 +165,12 @@ export default defineUntypedSchema({
|
||||
* A unique identifier matching the build. This may contain the hash of the current state of the project.
|
||||
*/
|
||||
buildId: {
|
||||
$resolve: (val: string) => val ?? randomUUID(),
|
||||
$resolve: async (val: string | undefined, get): Promise<string> => {
|
||||
if (typeof val === 'string') { return val }
|
||||
|
||||
const [isDev, isTest] = await Promise.all([get('dev') as Promise<boolean>, get('test') as Promise<boolean>])
|
||||
return isDev ? 'dev' : isTest ? 'test' : randomUUID()
|
||||
},
|
||||
},
|
||||
|
||||
/**
|
||||
|
@ -13,14 +13,10 @@ export default defineVitestConfig({
|
||||
environmentOptions: {
|
||||
nuxt: {
|
||||
overrides: {
|
||||
buildId: 'override',
|
||||
experimental: {
|
||||
appManifest: process.env.TEST_MANIFEST !== 'manifest-off',
|
||||
},
|
||||
runtimeConfig: {
|
||||
app: {
|
||||
buildId: 'override',
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
|
Loading…
Reference in New Issue
Block a user