Skip to content

Commit c2a96e2

Browse files
committed
Anchor integrations cache on cwd, not import.meta.url
1 parent aa29b16 commit c2a96e2

1 file changed

Lines changed: 3 additions & 5 deletions

File tree

nuxt/server/utils/build-cache.ts

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,15 +10,13 @@
1010
* layer is idiomatic to Nuxt and trivially swappable to another driver later.
1111
*/
1212
import { createHash } from 'node:crypto'
13-
import { fileURLToPath } from 'node:url'
14-
import { dirname, resolve } from 'node:path'
13+
import { resolve } from 'node:path'
1514
import { ofetch } from 'ofetch'
1615
import { createStorage } from 'unstorage'
1716
import fsDriver from 'unstorage/drivers/fs-lite'
1817

19-
// Anchor the cache to the nuxt workspace so it's stable regardless of which
20-
// directory `nuxt generate` was launched from. Lands at nuxt/.cache/integrations/.
21-
const CACHE_DIR = resolve(dirname(fileURLToPath(import.meta.url)), '../../.cache/integrations')
18+
// cwd, not import.meta.url — Nitro bundles this file and the rewritten URL resolves above filesystem root.
19+
const CACHE_DIR = resolve(process.cwd(), '.cache/integrations')
2220

2321
const storage = createStorage({
2422
driver: fsDriver({ base: CACHE_DIR })

0 commit comments

Comments
 (0)