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
1515import { build } from 'esbuild' ;
16- import { unlinkSync } from 'node:fs' ;
1716
1817// Packages that cannot be bundled (native bindings / optional drivers)
1918const EXTERNAL = [
@@ -33,7 +32,7 @@ const EXTERNAL = [
3332] ;
3433
3534await 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