Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Failed to build with vitepress #223

Open
4 tasks done
imengyu opened this issue Apr 29, 2024 · 0 comments
Open
4 tasks done

Failed to build with vitepress #223

imengyu opened this issue Apr 29, 2024 · 0 comments

Comments

@imengyu
Copy link

imengyu commented Apr 29, 2024

Describe the bug

I m using vue-codemirror in vitepress project, it work fine in development mode, but it can not build, i receive this error:

✖ rendering pages...
build error:
file:///F:/Programming/WebProjects/test/.vitepress/.temp/index.md.js?t=1714413605827:3
import { Codemirror } from "vue-codemirror";
         ^^^^^^^^^^
SyntaxError: Named export 'Codemirror' not found. The requested module 'vue-codemirror' is a CommonJS module, which may not support all module.exports as named exports.
CommonJS modules can always be imported via the default export, for example using:

import pkg from 'vue-codemirror';
const { Codemirror } = pkg;

    at ModuleJob._instantiate (node:internal/modules/esm/module_job:134:21)
    at async ModuleJob.run (node:internal/modules/esm/module_job:217:5)
    at async ModuleLoader.import (node:internal/modules/esm/loader:323:24)
    at async renderPage (file:///F:/Programming/WebProjects/test/node_modules/vitepress/dist/node/serve-CXVdC751.js:46638:28)
    at async pMap.concurrency (file:///F:/Programming/WebProjects/test/node_modules/vitepress/dist/node/serve-CXVdC751.js:46873:11)
    at async file:///F:/Programming/WebProjects/test/node_modules/vitepress/dist/node/serve-CXVdC751.js:2614:20

I have created a brand new vitepress project, but unfortunately, this issue still exists cannot build.

It seems that vue-codemirror has not been updated for a long time. Does it support the latest vite?

Reproduction

  1. Open this minimal replication project demo.zip
  2. Install dependencies
  3. Run vitepress build to execute the build,
  4. It displays an error message

System Info

System:
    OS: Windows 10 10.0.19045
    CPU: (16) x64 11th Gen Intel(R) Core(TM) i9-11900KF @ 3.50GHz
    Memory: 48.07 GB / 63.88 GB
  Binaries:
    Node: 20.12.0 - C:\Program Files\nodejs\node.EXE
    npm: 10.5.0 - C:\Program Files\nodejs\npm.CMD
  Browsers:
    Edge: Chromium (123.0.2420.97)
    Internet Explorer: 11.0.19041.3636
  npmPackages:
    @codemirror/lang-javascript: ^6.2.2 => 6.2.2
    codemirror: ^6.0.1 => 6.0.1
    vitepress: ^1.1.4 => 1.1.4
    vue-codemirror: ^6.1.1 => 6.1.1

Used Package Manager

npm

Validations

  • Read the the documentation in detail.
  • Check that there isn't already an issue that reports the same bug to avoid creating a duplicate.
  • Check that this is a concrete bug. For Q&A open a GitHub Discussion or join our Discord Chat Server.
  • The provided reproduction is a minimal reproducible example of the bug.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant