antfu / vite-plugin-md

Markdown with Vue for Vite
MIT License
604 stars 89 forks source link

安装后,运行项目报错 #139

Open lt216 opened 1 year ago

lt216 commented 1 year ago

package.json

 "vite-plugin-md": "^0.22.5",

vite.config.ts

import markdown from "vite-plugin-md"
export default defineConfig({
  plugins: [
    vue({
      include: [/\.vue$/, /\.md$/] // <--
    }),
 ],
})

运行vite项目

sudo npm run dev

错误如下

failed to load config from /Users/test/www/kqt/web/vite.config.ts

error when starting dev server:                                                                                                                                                                     16:36:59
Error [ERR_PACKAGE_PATH_NOT_EXPORTED]: No "exports" main defined in /Users/test/www/kqt/web/node_modules/@yankeeinlondon/happy-wrapper/package.json
    at new NodeError (node:internal/errors:399:5)
    at exportsNotFound (node:internal/modules/esm/resolve:361:10)
    at packageExportsResolve (node:internal/modules/esm/resolve:641:13)
    at resolveExports (node:internal/modules/cjs/loader:565:36)
    at Module._findPath (node:internal/modules/cjs/loader:634:31)
    at Module._resolveFilename (node:internal/modules/cjs/loader:1061:27)
    at Module._load (node:internal/modules/cjs/loader:920:27)
    at Module.require (node:internal/modules/cjs/loader:1141:19)
    at require (node:internal/modules/cjs/helpers:110:18)
    at Object.<anonymous> (/Users/test/www/kqt/web/node_modules/vite-plugin-md/dist/index.cjs:18030:28)
lzdml commented 1 year ago

这个错误通常是因为你安装的 vite-plugin-md 版本较新,而插件依赖的其他库的版本较旧,导致在处理 ES Module 的导出时出现问题。

callmesoul commented 9 months ago

vite-plugin-md版本降到0.10.0版本就可以了