Context
base44-dev/apper PR #15137 adds CFW multi-file backend functions: a function may import a within-function helper (./util.ts) or a cross-function shared module (../../shared/x.ts). The CFW bundler compiles each function independently and resolves relative imports only within that function's submitted files set.
On the backend, the interactive deploy paths (editor save, single-function PUT, file-tree deploy) expand these server-side — they gather each function's reachable files before bundling. The batch full-sync endpoint (POST /backend-functions, used by base44 deploy) intentionally does not expand server-side: it deploys each function's files exactly as submitted (it stays the full-sync endpoint — it also prunes functions/automations removed from the payload, so it should keep being used; no new/special endpoint is needed).
Problem
If the CLI submits only each function's entry (flat main.ts / entry-only files), a function that imports ../../shared/x.ts (or ./util.ts) deploys without the shared module. The bundler then fails with the historical "...can't reach outside the function" error, or ships stale code.
Action
When deploying backend functions, the CLI should include each function's reachable backend files in that function's files payload:
- within-function helpers under
base44/functions/<name>/…
- cross-function shared modules reachable via
./ / ../ imports (base44/shared/*.ts, and any other reachable base44/… file), resolved transitively
so the server-side bundler resolves the relative imports within the submitted files. Resolution is exact-posix-match on the real project paths (e.g. ../../shared/x.ts from base44/functions/foo/entry.ts → base44/shared/x.ts).
Only base44/ code is bundleable — src/ (frontend) and root files (package.json, tailwind.config.js, index.html) must stay excluded (an escape into them should not resolve).
Notes
- Keep using the batch full-sync endpoint; this is a payload change (include reachable files), not an endpoint change.
- Managed builder apps are already covered server-side (they deploy through the file-tree path, which expands). This is specifically about CLI / Backend-Platform (unmanaged) deploys, where the CLI payload is the source of truth.
References
Context
base44-dev/apperPR #15137 adds CFW multi-file backend functions: a function may import a within-function helper (./util.ts) or a cross-function shared module (../../shared/x.ts). The CFW bundler compiles each function independently and resolves relative imports only within that function's submittedfilesset.On the backend, the interactive deploy paths (editor save, single-function
PUT, file-tree deploy) expand these server-side — they gather each function's reachable files before bundling. The batch full-sync endpoint (POST /backend-functions, used bybase44 deploy) intentionally does not expand server-side: it deploys each function'sfilesexactly as submitted (it stays the full-sync endpoint — it also prunes functions/automations removed from the payload, so it should keep being used; no new/special endpoint is needed).Problem
If the CLI submits only each function's entry (flat
main.ts/ entry-onlyfiles), a function that imports../../shared/x.ts(or./util.ts) deploys without the shared module. The bundler then fails with the historical"...can't reach outside the function"error, or ships stale code.Action
When deploying backend functions, the CLI should include each function's reachable backend files in that function's
filespayload:base44/functions/<name>/….//../imports (base44/shared/*.ts, and any other reachablebase44/…file), resolved transitivelyso the server-side bundler resolves the relative imports within the submitted
files. Resolution is exact-posix-match on the real project paths (e.g.../../shared/x.tsfrombase44/functions/foo/entry.ts→base44/shared/x.ts).Only
base44/code is bundleable —src/(frontend) and root files (package.json,tailwind.config.js,index.html) must stay excluded (an escape into them should not resolve).Notes
References