Skip to content

Commit 1a61747

Browse files
committed
fix: use project-relative alias strings in default platform config
Why: Turbopack's `resolveAlias` treats absolute paths as server-relative (prepending `./`) and rejects them with "server relative imports are not implemented yet". The `fileURLToPath(new URL(...))` pattern produced absolute paths that broke the plain `pnpm build` CI job. Project-relative strings resolve correctly in both Turbopack and webpack.
1 parent c88bfc5 commit 1a61747

1 file changed

Lines changed: 6 additions & 8 deletions

File tree

apps/site/next.platform.config.mjs

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,19 @@
1-
import { fileURLToPath } from 'node:url';
2-
31
/**
42
* Default (no-op) platform config used when no `DEPLOY_TARGET` is set —
53
* local dev, static export, generic hosting, etc.
64
*
75
* Platform deployments (Vercel, Cloudflare, …) provide their own
86
* `next.platform.config.mjs` that overrides these values. Keep this
97
* file free of any platform-specific code.
8+
*
9+
* Alias values are project-relative strings (not absolute paths) so
10+
* Turbopack resolves them correctly — Turbopack treats absolute paths
11+
* as server-relative and rejects them.
1012
*/
1113
export default {
1214
aliases: {
13-
'@platform/analytics': fileURLToPath(
14-
new URL('./platform/analytics.tsx', import.meta.url)
15-
),
16-
'@platform/instrumentation': fileURLToPath(
17-
new URL('./platform/instrumentation.ts', import.meta.url)
18-
),
15+
'@platform/analytics': './platform/analytics.tsx',
16+
'@platform/instrumentation': './platform/instrumentation.ts',
1917
},
2018
mdx: {
2119
// Defaults for local dev / static export / generic hosting. Platform

0 commit comments

Comments
 (0)