emersonbottero / vitepress-plugin-mermaid

Add mermaid support for Vitepress
MIT License
87 stars 20 forks source link

using withMermaid breaks dev server in vitepress alpha 35 #28

Closed dominikcz closed 1 year ago

dominikcz commented 1 year ago

As title says, when you use withMermaid() in your config.js like this:

// .vitepress/config.js
import { withMermaid } from "vitepress-plugin-mermaid";

export default withMermaid({
  // your existing vitepress config...
});

and you run

npm run dev

you end up with an empty page and after some time (and 1530 requests) error in console:

Uncaught SyntaxError: ambiguous indirect export: default mermaid.core.mjs:7:7

with npm run build everything seems to work correctly

emersonbottero commented 1 year ago

the problem is the mermaid version not the vitepress version. see #24

dominikcz commented 1 year ago

OK, you are right and I can confirm that solution suggested in #24 (below) works... although I'd rather not have to use it

// docs/vite.config.ts or docs/vite.config.js
import { defineConfig } from "vite";

export default defineConfig({
  resolve: {
    alias: {
        "mermaid": "mermaid/dist/mermaid.esm.mjs",
    },
  },
});
emersonbottero commented 1 year ago

fixed in #32