Commit 93b52a6
fix(server): replace Function constructor with proper dynamic imports for esbuild bundling
Replace `new Function('s', 'return import(s)')` with standard `import()` statements
in bootstrap.ts to allow esbuild to analyze and bundle the config files.
The Function constructor pattern bypassed static analysis, preventing esbuild from
including objectstack.config.ts and example configs in the Vercel bundle. This caused
runtime module resolution errors when the source .ts files weren't deployed.
With proper dynamic imports, esbuild can now:
- Analyze imports at build time
- Resolve and bundle objectstack.config.ts
- Include example app configs when needed
- Produce a self-contained _handler.js bundle
Fixes: Cannot find module '/var/task/apps/server/objectstack.config.ts'
Agent-Logs-Url: https://github.com/objectstack-ai/framework/sessions/6b0db307-90c8-4fdd-8603-d1b61f3373da
Co-authored-by: hotlong <50353452+hotlong@users.noreply.github.com>1 parent 7e85490 commit 93b52a6
1 file changed
Lines changed: 14 additions & 13 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
90 | 90 | | |
91 | 91 | | |
92 | 92 | | |
93 | | - | |
94 | | - | |
95 | | - | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
96 | 99 | | |
97 | 100 | | |
98 | 101 | | |
| |||
214 | 217 | | |
215 | 218 | | |
216 | 219 | | |
217 | | - | |
218 | | - | |
219 | | - | |
220 | | - | |
221 | | - | |
222 | | - | |
223 | | - | |
| 220 | + | |
| 221 | + | |
| 222 | + | |
| 223 | + | |
| 224 | + | |
224 | 225 | | |
225 | | - | |
226 | | - | |
227 | | - | |
| 226 | + | |
| 227 | + | |
| 228 | + | |
228 | 229 | | |
229 | 230 | | |
230 | 231 | | |
| |||
0 commit comments