Commit 98e93a1
fix(json-provider): resolve DUMP_DIR when Turbopack strips import.meta.dirname (#374)
`import.meta.dirname` is undefined in workspace-package code that Next.js 16 +
Turbopack bundles into server chunks, so the `resolve(import.meta.dirname, '..')`
in getStore() threw ERR_INVALID_ARG_TYPE on every API route that touched the
JSON dump path (Option A in the README). Pages rendered but every /api/v1/* call
500'd.
`import.meta.url` is preserved correctly by Turbopack and still points at the
original source file, so fall back to `dirname(fileURLToPath(import.meta.url))`
when `import.meta.dirname` is unavailable. Behavior is identical for tsx, plain
Node ESM, and vitest, where `import.meta.dirname` is defined and the ?? short-
circuits.
No production impact: Vercel uses DATABASE_READONLY_URL, never DUMP_DIR, so
getStore() is unreachable in prod.
Co-authored-by: Claude Opus 4.7 <noreply@anthropic.com>1 parent e7d022d commit 98e93a1
1 file changed
Lines changed: 7 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
9 | 9 | | |
10 | 10 | | |
11 | 11 | | |
12 | | - | |
| 12 | + | |
| 13 | + | |
13 | 14 | | |
14 | 15 | | |
15 | 16 | | |
| |||
168 | 169 | | |
169 | 170 | | |
170 | 171 | | |
171 | | - | |
| 172 | + | |
| 173 | + | |
| 174 | + | |
| 175 | + | |
| 176 | + | |
172 | 177 | | |
173 | 178 | | |
174 | 179 | | |
| |||
0 commit comments