vaemusic / datav-vue3

datav Vue3+TS+Vite版
https://datav-vue3.netlify.app
MIT License
510 stars 71 forks source link

vitepress打包不成功 #39

Closed BlueBubbleWei closed 1 year ago

BlueBubbleWei commented 1 year ago

.pnpm\@kjgl77+datav-vue3@1.5.0_vue@3.2.47\node_modules\@kjgl77\datav-vue3\dist\datav-vue3.es.js:1 import './style.css'; ^^^^^^

SyntaxError: Cannot use import statement outside a module at Object.compileFunction (node:vm:352:18) at wrapSafe (node:internal/modules/cjs/loader:1033:15) at Module._compile (node:internal/modules/cjs/loader:1069:27) at Module._extensions..js (node:internal/modules/cjs/loader:1159:10) at Module.load (node:internal/modules/cjs/loader:981:32) at Module._load (node:internal/modules/cjs/loader:827:12) at ModuleWrap. (node:internal/modules/esm/translators:170:29) at ModuleJob.run (node:internal/modules/esm/module_job:198:25) at async Promise.all (index 0) at async ESMLoader.import (node:internal/modules/esm/loader:409:24)

安装的依赖

"dependencies": { "@element-plus/icons-vue": "^2.1.0", "@kjgl77/datav-vue3": "^1.5.0", "element-plus": "^2.3.4", "turndown": "^7.1.1", "vue": "^3.2.47", "vue-devui": "^1.1.0" }, "devDependencies": { "@babel/generator": "^7.21.5", "@babel/parser": "^7.21.8", "@babel/traverse": "^7.21.5", "@babel/types": "^7.21.5", "@types/node": "^20.1.1", "@vitejs/plugin-vue": "^4.2.1", "@vitejs/plugin-vue-jsx": "^3.0.1", "escape-html": "^1.0.3", "fast-glob": "^3.2.12", "highlight.js": "^11.8.0", "markdown-it-container": "^3.0.0", "marked": "^5.0.1", "node-sass": "^8.0.0", "prismjs": "^1.29.0", "sass": "^1.62.1", "sass-loader": "^13.2.2", "turndown-plugin-gfm": "^1.0.2", "unocss": "^0.51.12", "unplugin-auto-import": "^0.15.3", "vite": "^4.3.5", "vite-plugin-dts": "^2.3.0", "vite-plugin-vue": "^0.0.0", "vitepress": "1.0.0-alpha.75" }

vaemusic commented 1 year ago

在 vitepress 的 config.ts 配置上加上

vite: {
    ssr: {
      noExternal: ['@kjgl77/datav-vue3']
    },
 }

问题链接:https://github.com/vuejs/vitepress/issues/1695