Skip to content

Commit 64a87a4

Browse files
Web3NLclaude
andauthored
fix(icp-dapp-launcher): use production II URL and fix JS asset paths on IC (#271)
* fix(icp-dapp-launcher): use production II URL and fix JS asset paths 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> * fix: bump pocket-ic crate to 13.0.0 to match server binary 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> * chore: bump icp-dapp-launcher version (patch) * fix(icp-dapp-launcher): hardcode mainnet canister IDs as fallback 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> --------- Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
1 parent 2dd722f commit 64a87a4

7 files changed

Lines changed: 25 additions & 20 deletions

File tree

Cargo.lock

Lines changed: 4 additions & 5 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ ic-ledger-types = "0.16.0"
2929
include_dir = "0.7.4"
3030
icrc-ledger-types = "0.1.12"
3131
mime_guess = "2.0.5"
32-
pocket-ic = "12.0.0"
32+
pocket-ic = "13.0.0"
3333
serde = { version = "1.0.228", features = ["derive"] }
3434
serde_cbor = "0.11.2"
3535
serde_json = "1.0.149"

canisters/icp-dapp-launcher/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
{
22
"name": "icp-dapp-launcher",
3-
"version": "1.1.0",
3+
"version": "1.1.1",
44
"dependencies": {
55
"@dfinity/gix-components": "^10.0.0",
66
"@web3nl/my-canister-dashboard": "0.8.0"
77
},
8-
"deployedAtCommit": "3ccd54cd9ac462d4f2f358a4d2cac18bf2d86f82",
8+
"deployedAtCommit": "8a47e4467cefcc80488edd65cc7042bdf975c351",
99
"engines": {
1010
"node": ">=22.0.0"
1111
},

canisters/icp-dapp-launcher/src/lib/constants/canisterIds.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,9 @@ export const INDEX_CANISTER_ID = 'qhbym-qaaaa-aaaaa-aaafq-cai';
33
export const CMC_CANISTER_ID = 'rkp4c-7iaaa-aaaaa-aaaca-cai';
44

55
export const WASM_REGISTRY_CANISTER_ID =
6-
(import.meta.env.VITE_WASM_REGISTRY_CANISTER_ID as string) || '';
6+
(import.meta.env.VITE_WASM_REGISTRY_CANISTER_ID as string) ||
7+
'eeqt3-riaaa-aaaal-qbsva-cai';
78

89
export const DEMOS_CANISTER_ID =
9-
(import.meta.env.VITE_DEMOS_CANISTER_ID as string) || '';
10+
(import.meta.env.VITE_DEMOS_CANISTER_ID as string) ||
11+
'maqro-xqaaa-aaaal-qceuq-cai';
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
export const prerender = true;
22
export const ssr = false;
3-
export const trailingSlash = 'ignore';
3+
export const trailingSlash = 'always';

package-lock.json

Lines changed: 7 additions & 7 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

scripts/deploy-launcher.sh

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,9 +26,13 @@ if [[ -n $(git status --porcelain) ]]; then
2626
exit 1
2727
fi
2828

29-
# Deploy the app (ICP_NETWORK=ic triggers production build)
29+
# Build the launcher for production — ICP_NETWORK=ic must be set during vite build
30+
# so the PROD constant is true at compile time (icp deploy does not run npm build)
31+
echo "🔨 Building icp-dapp-launcher for production..."
32+
(cd canisters/icp-dapp-launcher && ICP_NETWORK=ic npm run build)
33+
3034
echo "🚢 Deploying to IC..."
31-
ICP_NETWORK=ic icp deploy icp-dapp-launcher -e mainnet --identity web3nl
35+
icp deploy icp-dapp-launcher -e mainnet --identity web3nl
3236

3337
# Get current commit hash after successful deploy
3438
COMMIT_HASH=$(git rev-parse HEAD)

0 commit comments

Comments
 (0)