Skip to content

Commit b83fef3

Browse files
committed
feat: migrate API entry point to server/index.ts and update bundling script
1 parent 9d24f0b commit b83fef3

File tree

2 files changed

+3
-9
lines changed

2 files changed

+3
-9
lines changed

apps/studio/scripts/bundle-api.mjs

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -5,15 +5,14 @@
55
* which can cause esbuild to resolve to TypeScript source files rather than
66
* compiled dist output — producing ERR_MODULE_NOT_FOUND at runtime.
77
*
8-
* This script bundles api/index.ts with ALL dependencies inlined (including
8+
* This script bundles server/index.ts with ALL dependencies inlined (including
99
* npm packages), so the deployed function is self-contained. Only packages
1010
* with native bindings and optional database drivers are kept external.
1111
*
1212
* Run from the apps/studio directory during the Vercel build step.
1313
*/
1414

1515
import { build } from 'esbuild';
16-
import { unlinkSync } from 'node:fs';
1716

1817
// Packages that cannot be bundled (native bindings / optional drivers)
1918
const EXTERNAL = [
@@ -33,7 +32,7 @@ const EXTERNAL = [
3332
];
3433

3534
await build({
36-
entryPoints: ['api/index.ts'],
35+
entryPoints: ['server/index.ts'],
3736
bundle: true,
3837
platform: 'node',
3938
format: 'esm',
@@ -45,9 +44,4 @@ await build({
4544
logOverride: { 'require-resolve-not-external': 'silent' },
4645
});
4746

48-
// Remove the TypeScript source so Vercel only sees the compiled .js bundle.
49-
// Since package.json has "type": "module", .js files are treated as ESM —
50-
// matching the esbuild `format: 'esm'` output.
51-
unlinkSync('api/index.ts');
52-
53-
console.log('[bundle-api] Bundled api/index.ts → api/index.js');
47+
console.log('[bundle-api] Bundled server/index.ts → api/index.js');

0 commit comments

Comments
 (0)