fix: use mermaid IFFE instead of bundling mermaid #685
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
📑 Summary
Add support for Mermaid v10.9.0 and KaTeX, by importing the mermaid IFFE, instead of bundling it.
Since 9e168fb, we're bundling mermaid using vite. The main reason was that back then, Mermaid was only offering an ESM version of some libraries, but puppeteer doesn't support importing ESM from
file://
URLs, due to CORS errors.Unfortunately, the large size of KaTeX in Mermaid v10.9.0 seems to be somehow breaking
mermaid-cli
on slow computers.However, Mermaid v10.2.0 added back the IFFE bundle, so we can now use that instead, in a
<script src='file://'>
, and we therefore don't need to bundle it.This seems to fix the issue. It also means that we can move
mermaid
fromdevDependencies
to adependencies
, allowing users to update their mermaid version independently frommermaid-cli
!Resolves #680
Closes #663
📏 Design Decisions
Describe the way your implementation works or what design decisions you made if applicable.
📋 Tasks
Make sure you
master
branch