fix(icp-dapp-launcher): use production II URL and fix JS asset paths on IC#271
Merged
Conversation
…on IC Two bugs prevented correct production deployment: 1. deploy-launcher.sh ran `icp deploy` without first running `npm run build`. The `icp` tool only uploads the existing build/ directory — it never invokes Vite. So ICP_NETWORK=ic had no effect and PROD was always false, embedding the local dev II URL (rdmx6-jaaaa...) instead of https://id.ai. Fix: explicitly build with ICP_NETWORK=ic before deploying. 2. trailingSlash='ignore' caused SvelteKit to output launch.html with relative asset paths like ./_app/... The ICP HTTP gateway redirects /launch → /launch/ (trailing slash) because files exist under /launch/. At /launch/, the paths resolve to /launch/_app/... which doesn't exist, so the asset canister returns its HTML fallback — causing the 'text/html' MIME type error on JS module scripts. Fix: trailingSlash='always' generates launch/index.html with ../_app/... paths that resolve correctly from /launch/. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Local PocketIC server binary is v13.0.0 but the workspace crate was pinned to 12.0.0 (which rejects >=13). Bumping to 13.0.0 resolves the version mismatch. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
wasm-registry and demos now default to mainnet IDs so local dev and production both work without VITE_* env vars set. The VITE_* override is kept for CI, where local canisters are deployed with different IDs. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
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.
Summary
Wrong II URL in prod:
deploy-launcher.shcalledicp deploywithout first runningnpm run build. Theicptool only uploads the existingbuild/directory — it never invokes Vite. SoICP_NETWORK=ichad no effect,PRODwas alwaysfalse, and the local dev II URL (rdmx6-jaaaa...) was embedded instead ofhttps://id.ai. Fixed by explicitly building withICP_NETWORK=icbefore deploying.JS assets returning
text/htmlMIME error:trailingSlash='ignore'caused SvelteKit to outputlaunch.htmlwith relative asset paths like./_app/.... The ICP HTTP gateway redirects/launch→/launch/because files exist under/launch/. At/launch/, those paths resolve to/launch/_app/...which doesn't exist, so the asset canister returns its HTML fallback — causingtext/htmlMIME type on JS module scripts. Fixed by switching totrailingSlash='always', which generateslaunch/index.htmlwith../_app/...paths that resolve correctly from/launch/.Test plan
./scripts/deploy-launcher.sh patchand verify the deployed app useshttps://id.aifor II loginhttps://mycanister.app/launch🤖 Generated with Claude Code