Closed sharebear closed 1 year ago
Thanks for your structure. it works
I have this same error, if I follow those steps at the end I'm able to see my vitepress site, but no mermaid graph gets rendered. and if as the OP I try to make a clean install, it doesnt work... is there any aditional steps other than the ones outlined in the previous comments.
i did get it to work , but static compilation doesn't work. it complains about vue/server-renderer.
does it work with current dependencies for anyone here?
I was also having the same problem. Tried a couple of combinations and only managed to make it work with Mermaid 8. Here's my package.json
:
{
"scripts": {
"docs:dev": "vitepress dev",
"docs:build": "vitepress build",
"docs:preview": "vitepress preview"
},
"devDependencies": {
"@mermaid-js/mermaid-mindmap": "^9.3.0",
"mermaid": "^8.14.0",
"vitepress": "^1.0.0-alpha.74",
"vitepress-plugin-mermaid": "^2.0.10"
}
}
fixed this bug → https://github.com/altpoint/vitepress-plugin-mermaid
I tried as well on a vitepress@1.0.0-beta.1
, it fails with mermaid 9 and 10 with the error you reported, I tried to use @altpoint's fork, it doesn't work either. I tried to rollback to mermaid 8, it doesn't fail with the error your reported, it just outputs a div containing the string undefined
instead of the expected diagram.
I'm very eager to see this work as I'm currently relying on a half-baked plantuml-based diagram generation which outputs not that pretty diagrams and which are not compatible with the dark-mode.
here is an working example.. does not matter the version of vitepress.. only the mermaid version. the last ones started to using libraries not compatible to esm.
now it is working with the latest version..
I've just spent the whole work day trying to get this working on a fresh project and I still don't have a config that works for both the dev server and the static build...
Steps to reproduce
Expected result
Can open page in browser ready to start adding diagrams to the scaffolded documentation
Actual result
In chome, it just hangs, in Firefox I get an error message on the console.
What I've tried
I found this comment so added the following to
docs/vite.config.ts
New Error in firefox
Following the link in the error message I see this is related to dayjs, and through various searches end up with the following in my
vite.config.ts
Success! The scaffolded site renders. I add my first simple diagram to the
docs/markdown-example.md
Still working, looking good so far...
Now it's time to try building the static site...
This ends up with the following error message
And here is where I'm currently stuck... had some other problems along the way (I was first using yarn, that gave me mermaid 10, which doesn't work as renderAsync has been removed).
If it helps my
package.json
currently looks like this