作者:涛涛哈帅_365 | 来源:互联网 | 2022-12-08 10:51
我正在使用vue-cli通过以下命令构建我的库:
"build": "vue-cli-service build --target lib --name myLib ./src/component.vue"
构建后如何从dist文件夹导入组件?
如果我从导入path-to-myLib/src/component.vue
,一切都很好!但是下面的代码不起作用:
// undefined
import { component } from 'path-to-myLib/dist/myLib.umd.js'
// undefined
import myComponent'path-to-myLib/dist/myLib.umd.js'
// result: https://i.stack.imgur.com/xHSzL.png
import * as myComponent'path-to-myLib/dist/myLib.umd.js'
我不明白问题是什么。