File tree Expand file tree Collapse file tree
Open diff view settings
Expand file tree Collapse file tree
Open diff view settings
Original file line number Diff line number Diff line change @@ -332,7 +332,8 @@ async function processCollectionItems(nuxt: Nuxt, collections: ResolvedCollectio
332332 for await ( const source of collection . source ) {
333333 if ( source . prepare ) {
334334 // @ts -expect-error - `__rootDir` is a private property to store the layer's cwd
335- const rootDir = collection . __rootDir || nuxt . options . rootDir
335+ const rootDir = ( source . repository ? options . _remoteSourceRootDir : collection . __rootDir )
336+ || nuxt . options . rootDir
336337 await source . prepare ( { rootDir } )
337338 }
338339
Original file line number Diff line number Diff line change 1- import { mkdir , writeFile } from 'node:fs/promises'
2- import { resolve } from 'pathe'
1+ import { tmpdir } from 'node:os'
2+ import { mkdir , writeFile , mkdtemp } from 'node:fs/promises'
3+ import { resolve , join } from 'pathe'
34import { provider } from 'std-env'
45import { logger } from '../utils/dev'
56import { definePreset } from '../utils/preset'
@@ -43,6 +44,13 @@ export default definePreset({
4344 else {
4445 await nodePreset . setup ?.( options , nuxt , config )
4546 }
47+
48+ if ( preset . includes ( 'vercel' ) ) {
49+ // Change remoteSourceRootDir to a temporary directory
50+ // this will prevent conflicts with the Vercel build cache
51+ // @ts -expect-error - `_remoteSourceRootDir` is a private property to store the temporary directory
52+ options . _remoteSourceRootDir = options . _remoteSourceRootDir || await mkdtemp ( join ( tmpdir ( ) , 'nuxt-content' ) )
53+ }
4654 } ,
4755 async setupNitro ( nitroConfig , options ) {
4856 const { nuxt } = options as unknown as { nuxt : Nuxt & { options : { hub : { db ?: boolean | object , database ?: boolean } } } }
Original file line number Diff line number Diff line change 1+ import { mkdtemp } from 'node:fs/promises'
2+ import { tmpdir } from 'node:os'
3+ import { join } from 'pathe'
14import { definePreset } from '../utils/preset'
25import { logger } from '../utils/dev'
36import nodePreset from './node'
@@ -13,6 +16,11 @@ export default definePreset({
1316 options . experimental ||= { }
1417 options . experimental . sqliteConnector ||= 'bun'
1518 }
19+
20+ // Change remoteSourceRootDir to a temporary directory
21+ // this will prevent conflicts with the Vercel build cache
22+ // @ts -expect-error - `_remoteSourceRootDir` is a private property to store the temporary directory
23+ options . _remoteSourceRootDir = options . _remoteSourceRootDir || await mkdtemp ( join ( tmpdir ( ) , 'nuxt-content' ) )
1624 } ,
1725 async setupNitro ( nitroConfig ) {
1826 const database = nitroConfig . runtimeConfig ?. content ?. database
You can’t perform that action at this time.
0 commit comments