Skip to content

Commit c261b2c

Browse files
ovflowdclaude
andcommitted
fix(platform): stop tsconfig paths from shadowing the @platform alias
The `@platform/*` entry in `apps/site/tsconfig.json` was being picked up by `tsconfig-paths-webpack-plugin` before webpack's `resolve.alias`, which caused the Cloudflare worker bundle to include the default platform's MDX config (`wasm: true`) instead of cloudflare's (`wasm: false`). At runtime the worker hit `WebAssembly.instantiate(): Wasm code generation disallowed by embedder`. Drop the tsconfig path, declare a wildcard ambient module `@platform/*` for `lint:types`, and let webpack's alias be the sole source of truth for `@platform/*` resolution. The alias can now be the plain package specifier, so the `createRequire` + `dirname` workaround goes away too. Co-Authored-By: Claude Opus 4.7 <[email protected]>
1 parent 57b7c38 commit c261b2c

3 files changed

Lines changed: 10 additions & 13 deletions

File tree

apps/site/next.config.mjs

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,10 +20,6 @@ const { default: platform } = await import(`${PLATFORM_ALIAS}/next.config.mjs`);
2020
const platformImages = await platform.images?.();
2121
const platformNextConfig = await platform.nextConfig?.();
2222

23-
// Single wildcard alias: `@platform/<file>` resolves to
24-
// `@node-core/platform-${DEPLOY_TARGET}/<file>` so each deploy target's
25-
// files (analytics slot, instrumentation, MDX/Shiki config) are picked
26-
// up automatically without per-file mappings.
2723
const platformAliases = { '@platform': PLATFORM_ALIAS };
2824

2925
/** @type {import('next').NextConfig} */
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
/**
2+
* Wildcard ambient module declaration for the `@platform/*` webpack alias.
3+
*
4+
* The alias is resolved at build time by `apps/site/next.config.mjs` to the
5+
* active `@node-core/platform-<target>` package. We declare it here (rather
6+
* than via `tsconfig.json`'s `paths`) so that `tsconfig-paths-webpack-plugin`
7+
* can't shadow the webpack alias and bundle the wrong platform's files.
8+
*/
9+
declare module '@platform/*';

apps/site/tsconfig.json

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -17,15 +17,7 @@
1717
"jsx": "react-jsx",
1818
"incremental": true,
1919
"plugins": [{ "name": "next" }],
20-
"baseUrl": ".",
21-
"paths": {
22-
"@platform/*": [
23-
"../../platforms/default/*",
24-
"../../platforms/default/*.ts",
25-
"../../platforms/default/*.tsx",
26-
"../../platforms/default/*.mjs"
27-
]
28-
}
20+
"baseUrl": "."
2921
},
3022
"mdx": {
3123
"checkMdx": true

0 commit comments

Comments
 (0)