fix(dev): scaffold apps with the injected local dev server URL#571
Open
davidsu wants to merge 1 commit into
Open
fix(dev): scaffold apps with the injected local dev server URL#571davidsu wants to merge 1 commit into
davidsu wants to merge 1 commit into
Conversation
`base44 dev` injects VITE_BASE44_APP_BASE_URL so the app's SDK targets the
local dev backend, but the scaffolded base44Client only passed { appId }, so
the browser hit the remote backend instead of localhost. Pass serverUrl from
the injected env var; it is unset in prod builds, so the SDK falls back to its
default server.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Contributor
🚀 Package Preview Available!Install this PR's preview build with npm: npm i @base44-preview/cli@0.1.5-pr.571.4d6a59ePrefer not to change any import paths? Install using npm alias so your code still imports npm i "base44@npm:@base44-preview/cli@0.1.5-pr.571.4d6a59e"Or add it to your {
"dependencies": {
"base44": "npm:@base44-preview/cli@0.1.5-pr.571.4d6a59e"
}
}
Preview published to npm registry — try new features instantly! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Note
Description
Newly scaffolded
backend-and-clientapps ignored the local dev backend because the generated Base44 client had no way to point at it. This PR wires the client template to read theVITE_BASE44_APP_BASE_URLenv var thatbase44 devinjects (pointing athttp://localhost:<port>), so scaffolded apps talk to the local dev server during development while still falling back to the SDK default in production builds.Related Issue
None
Type of Change
Changes Made
serverUrl: import.meta.env.VITE_BASE44_APP_BASE_URL || undefinedon the generatedcreateClient()call in thebackend-and-clienttemplate (base44Client.js.ejs).base44 devand is unset in production builds, so the SDK falls back to its default server.Testing
Checklist
Additional Notes
The env var name matches what the dev server sets in
packages/cli/src/cli/dev/dev-server/main.ts(VITE_BASE44_APP_BASE_URL). This is a template-only change; existing generated projects are unaffected until re-scaffolded.🤖 Generated by Claude | 2026-07-20 12:36 UTC | 8e6eea5