0001. Load page bundles through asWebviewUri, not inline

Status: Accepted (2026-09-30)

Context

Each page today is one template literal with its style and script inline, under a nonce. The compiler never sees the page script, and every test harness depends on finding it inline. The official webview guide says its recommended CSP “implicitly disables inline scripts and styles. It is a best practice to extract all inline styles and scripts to external files.” GitLens, GitHub Pull Requests, Jupyter, Azure Cosmos DB, and DocumentDB all load their built JavaScript through asWebviewUri. None inlines it.

Decision

Each page’s HTML shell links dist/webview/<page>.css and loads dist/webview/<page>.js with <script nonce src>. localResourceRoots is dist/webview, plus resources/ where a page uses icons. The style nonce goes, and style-src becomes plain ${cspSource}.

Consequences

Alternatives considered