8000 Mermaid diagrams causing CSP errors due to dynamic chunk loading · Issue #3680 · RooCodeInc/Roo-Code · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Mermaid diagrams causing CSP errors due to dynamic chunk loading #3680

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
KJ7LNW opened this issue May 16, 2025 · 2 comments
Open

Mermaid diagrams causing CSP errors due to dynamic chunk loading #3680

KJ7LNW opened this issue May 16, 2025 · 2 comments
Assignees
Labels
bug Something isn't working enhancement New feature or request Issue - Unassigned / Actionable Clear and approved. Available for contributors to pick up.

Comments

@KJ7LNW
Copy link
Collaborator
KJ7LNW commented May 16, 2025

Problem

When rendering Mermaid diagrams in the webview, CSP errors are occurring because Mermaid is attempting to dynamically load chunks from the webview's origin. This results in errors like:

GET vscode-webview://0c4762q7l2h9q0cb4rf6d3l6ga6pf6gu28bfrppe2dbvd170lp01/assets/chunk-RZ5BOZE2.js net::ERR_ACCESS_DENIED
GET vscode-webview://0c4762q7l2h9q0cb4rf6d3l6ga6pf6gu28bfrppe2dbvd170lp01/assets/channel.js net::ERR_ACCESS_DENIED

Root Cause

Mermaid v11.4.1 is dynamically loading chunks at runtime, but these requests are being blocked by the webview's Content Security Policy because they're trying to load from the webview origin rather than through the vscode-webview-resource scheme.

Proposed Solution

Implement an enhanced bundling strategy in Vite that:

  1. Consolidates all Mermaid-related code into a single bundle using a custom manualChunks function
  2. Pre-bundles Mermaid and its dependencies (like dagre) using optimizeDeps.include
  3. Ensures predictable chunk naming to prevent dynamic loading issues

This approach should prevent Mermaid from attempting to load any chunks dynamically at runtime from the webview origin.

@dosubot dosubot bot added bug Something isn't working enhancement New feature or request labels May 16, 2025
@hannesrudolph hannesrudolph moved this from New to Issue [Unassigned] in Roo Code Roadmap May 21, 2025
@seedlord
Copy link

I would try claim and fix this

@hannesrudolph hannesrudolph added the Issue - Unassigned / Actionable Clear and approved. Available for contributors to pick up. label May 21, 2025
@KJ7LNW
Copy link
Collaborator Author
KJ7LNW commented May 21, 2025

I would try claim and fix this

sorry I forgot to link the pull request, this already exists and needs to be merged

@KJ7LNW KJ7LNW self-assigned this May 21, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working enhancement New feature or request Issue - Unassigned / Actionable Clear and approved. Available for contributors to pick up.
Projects
Status: Issue [Unassigned]
Development

No branches or pull requests

3 participants
0