Commit 8cc8914
fix: resolve Mermaid CSP errors with enhanced bundling strategy (#3681)
Implements a more robust bundling strategy for Mermaid diagrams to prevent
dynamic chunk loading at runtime, which was causing CSP violations.
Key changes:
- Added manualChunks function in vite.config.ts to consolidate all Mermaid
code and dependencies into a single bundle
- Added mermaid and dagre to optimizeDeps.include for pre-bundling
- Customized chunkFileNames to ensure predictable output
- Removed incorrect static imports in MermaidBlock.tsx
This resolves the CSP errors where Mermaid was attempting to dynamically
load chunks like chunk-RZ5BOZE2.js and channel.js from the webview origin.
Fixes: #3680
Signed-off-by: Eric Wheeler <[email protected]>
Co-authored-by: Eric Wheeler <[email protected]>
Co-authored-by: Daniel <[email protected]>1 parent 4befe5b commit 8cc8914
File tree
2 files changed
+39
-2
lines changed- webview-ui
- src/components/common
2 files changed
+39
-2
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
3 | | - | |
4 | 3 | | |
| 4 | + | |
5 | 5 | | |
6 | 6 | | |
7 | 7 | | |
8 | 8 | | |
9 | 9 | | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
10 | 14 | | |
11 | 15 | | |
12 | 16 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
98 | 98 | | |
99 | 99 | | |
100 | 100 | | |
101 | | - | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
102 | 108 | | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
103 | 131 | | |
104 | 132 | | |
105 | 133 | | |
| |||
116 | 144 | | |
117 | 145 | | |
118 | 146 | | |
| 147 | + | |
| 148 | + | |
| 149 | + | |
| 150 | + | |
| 151 | + | |
119 | 152 | | |
120 | 153 | | |
121 | 154 | | |
| |||
0 commit comments