emersonbottero / vitepress-plugin-mermaid

Add mermaid support for Vitepress
MIT License
95 stars 22 forks source link

SyntaxError: Importing binding name 'default' cannot be resolved by star export entries. #39

Closed glennsc closed 1 year ago

glennsc commented 1 year ago
  1. I followed the configuration instructions in the docs.
  2. On running docs:dev nothing renders and and I get the following error in the browser console:
SyntaxError: Importing binding name 'default' cannot be resolved by star export entries.

My .vitepress.config.js looks like this:

/**
 * @type {import('vitepress').UserConfig}
 */

import { defineConfig } from "vitepress";
import { withMermaid } from "vitepress-plugin-mermaid";

export default withMermaid(
  defineConfig({
    lang: "en-us",
    title: "My site",
    description: "My description",
    cleanUrls: true,
    lastUpdated: true,

    themeConfig: {
      nav: [
        { text: "Docs", link: "/getting-started/overview" },
        { text: "API Reference", link: "/api-ref" },
      ],

      footer: {
        message: "Confidential. For internal use only.",
        copyright: "Copyright © 2023, Me",
      },
    },
  })
);

Package.json:

{
  "name": "my-site",
  "main": "index.js",
  "scripts": {
    "docs:dev": "vitepress dev docs",
    "docs:build": "vitepress build docs",
    "docs:preview": "vitepress preview docs"
  },
  "keywords": [],
  "author": "",
  "license": "ISC",
  "devDependencies": {
    "@mermaid-js/mermaid-mindmap": "^9.3.0",
    "mermaid": "^9.3.0",
    "vitepress": "1.0.0-alpha.45",
    "vitepress-plugin-mermaid": "^2.0.10",
    "vue": "^3.2.47"
  }
}

Anything obvious I'm doing wrong?

image
emersonbottero commented 1 year ago

Is not .vitepress.config.js It should be .vitepress/config.js

glennsc commented 1 year ago

My apologies, that was just a typo when I wrote the issue. Yes, my file is in .vitepress/config.js

I created a minimal Vitepress install, and added the mermaid plugin per the docs, and still get the same error.

emersonbottero commented 1 year ago

try the solution mention here

glennsc commented 1 year ago

Okay, yes. Dropping a vite.config.js into docs with:

export default {
  optimizeDeps: { include: ['moment-mini', '@braintree/sanitize-url'] },
}

and then

pnpm add moment-mini @braintree/sanitize-url -D

stopped the errors throwing in dev. I see mermaid merged your PR fixing this so I assume we'll be able to remove this workaround soon. Really appreciate your help, and love this plugin.