-
Notifications
You must be signed in to change notification settings - Fork 1
Open
Description
Context
Identified in #95 (comment): the build.target: "esnext" recommendation proposed in #95 is unnecessary. The real issue is that skill code examples use bare top-level await, which fails with Vite's default build target (es2020).
Problem
Three skills have await at module scope in their code blocks. When an agent copies these into a Vite-bundled module, the build fails with "Top-level await is not available in the configured target environment".
Affected skills:
internet-identity/SKILL.md—await AuthClient.create(),await authClient.isAuthenticated()wallet-integration/SKILL.md—await IcrcWallet.connect(...)asset-canister/SKILL.md—await HttpAgent.create(...)
Fix
Wrap all top-level await examples in async functions:
async function init() {
const authClient = await AuthClient.create();
// ...rest of auth flow
}
init();This works with any Vite build target and is more realistic — real apps initialize inside lifecycle hooks or init functions, not at module scope.
Acceptance criteria
- All
awaitin code blocks across the three skills are inside functions -
npm run validatepasses - No
build.target: "esnext"added anywhere
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels