babel-plugin-component
babel-plugin-component copied to clipboard
多组件引入的时候报错
[
["component", {"libraryName": "library1", "styleLibraryName": "styles"}],
["component", {"libraryName": "library2", "styleLibraryName": "styles"}]
]
import { component } from "library2"
// 会报 library1/lib/component 找不到
兄弟,这个问题解决了吗
我分析了下, 示例是错误的。多个lib的时候,引用方式应该是 这个形式:
["component", [{ "libraryName": "element-ui", "styleLibraryName": "theme-chalk" }, { "libraryName": "mint-ui", "style": true }]],
@tengmaoqing 也是有问题的 https://github.com/nuxt/nuxt.js/issues/1603
我分析了下, 示例是错误的。多个lib的时候,引用方式应该是 这个形式:
["component", [{ "libraryName": "element-ui", "styleLibraryName": "theme-chalk" }, { "libraryName": "mint-ui", "style": true }]],
这种方式我这可以,之前是两个对象并列,有点第二个把第一个覆盖了的意思,现在放到一个数组里,就成了共存的了。。。以上纯属个人瞎猜,还是滚去看下源码把。。。
我分析了下, 示例是错误的。多个lib的时候,引用方式应该是 这个形式:
["component", [{ "libraryName": "element-ui", "styleLibraryName": "theme-chalk" }, { "libraryName": "mint-ui", "style": true }]],
这种方式可以解决 +1
@ZinLiao 我这里不行,试过了
@yoyo837 你的貌似是nuxt引起的吧,试下把nuxt的后端渲染关掉
Multiple Modules
{
"plugins": [
[
"component",
[
{
"libraryName": "antd",
"style": true
},
{
"libraryName": "test-module",
"style": true
},
// ...
]
]
}