Updating mermaid to 9.2.0 reported an error
Charles7c opened this issue · 15 comments
An error was reported at the console:
Uncaught SyntaxError: The requested module '/@fs/F:/Learn/02_Workspace/$个人站点/$个人知识库/charles7c.github.io/node_modules/.pnpm/dagre@0.8.5/node_modules/dagre/index.js?v=b2b200f6' does not provide an export named 'default' (at mermaid.core.mjs?v=b2b200f6:13:8)
Do you have a repo to share?
same here, and repo link is: https://codesandbox.io/s/beautiful-river-lv65vx
Do you have a repo to share?
You can clone and then upgrade the version in package.json.
https://github.com/Charles7c/charles7c.github.io
I'm having the same problem with version 2.0.8 and 2.0.6. Using vitepress 1.0.0-alpha.29.
mermaid.core.mjs?v=db61a261:13 Uncaught SyntaxError: The requested module '/@fs/电脑上项目的位置目录/node_modules/.pnpm/registry.npmmirror.com+dagre@0.8.5/node_modules/dagre/index.js?v=db61a261' does not provide an export named 'default' (at mermaid.core.mjs?v=db61a261:13:8)
how to use
我主要参考了文档的使用指南 Getting Started
pnpm i vitepress-plugin-mermaid mermaid -D
"dependencies": {
"vitepress": "1.0.0-alpha.29",
"vue": "^3.2.45"
},
"devDependencies": {
"mermaid": "^9.2.2",
"vitepress-plugin-mermaid": "^2.0.8"
}
import { defineConfig } from 'vitepress'
+ import { withMermaid } from 'vitepress-plugin-mermaid'
export default withMermaid(
defineConfig({
// my config
mermaid: {
// refer https://mermaid-js.github.io/mermaid/#/Setup for options
}
})
)
issue
我似乎遇到了上述类似的问题
I seem to be running into a similar problem to the above
You can take a look at this repo
Downgrading mermaid to 9.1.7 solves the issue. The first broken version is 9.2.0-rc2.
{
"devDependencies": {
"mermaid": "9.1.7",
...
}
}
@bojanrajh This works, thanks a lot
Downgrading mermaid to 9.1.7 solves the issue. The first broken version is 9.2.0-rc2.
{ "devDependencies": { "mermaid": "9.1.7", ... } }
Thanks for the info.. 9.1.7 works.
Seems 9.2 supports mindmap which 9.1.7 does not.
Still need to support the latest version of mermaid in a long run.
Downgrading mermaid to 9.1.7 solves the issue. The first broken version is 9.2.0-rc2.
{ "devDependencies": { "mermaid": "9.1.7", ... } }Thanks for the info.. 9.1.7 works.
Seems 9.2 supports mindmap which 9.1.7 does not. Still need to support the latest version of mermaid in a long run.
I tried it, the syntax of mindmap seems to be not working. Like:
mindmap
Root
A
B
C
I guess is the way mermaid is exporting the library after 9.2.2.
can you try to add an vite config?
// docs/vite.config.ts or docs/vite.config.js
import { defineConfig } from "vite";
export default defineConfig({
resolve: {
alias: {
"mermaid": "mermaid/dist/mermaid.esm.mjs",
},
},
});
// docs/vite.config.ts or docs/vite.config.js import { defineConfig } from "vite"; export default defineConfig({ resolve: { alias: { "mermaid": "mermaid/dist/mermaid.esm.mjs", }, }, });
Problem solved, thanks a lot.
Charles7c/charles7c.github.io@75090ce
// docs/vite.config.ts or docs/vite.config.js import { defineConfig } from "vite"; export default defineConfig({ resolve: { alias: { "mermaid": "mermaid/dist/mermaid.esm.mjs", }, }, });Problem solved, thanks a lot. Charles7c/charles7c.github.io@75090ce
Are you able to display mindmap with mermaid 9.3.0?
I got
> Syntax error in graph
> mermaid version 9.3.0
with below
mindmap
root((mindmap))
Origins
Long history
::icon(fa fa-book)
Popularisation
British popular psychology author Tony Buzan
Research
On effectivness<br/>and features
On Automatic creation
Uses
Creative techniques
Strategic planning
Argument mapping
Tools
Pen and paper
Mermaid
I didn't test mindmap, I just made sure my previous flowchart display didn't report errors.
I think it's another problem. 😄