-
Notifications
You must be signed in to change notification settings - Fork 96
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
怎么动态使用babel-plugin-component这个插件 #36
Comments
I got the error too.
|
我也碰到了,不过是新增babel-plugin-lodash插件时报的,后来发现是用nuxt hmr时直接修改编译配置会报这个错,停掉服务重新编译就没了 |
run dev时可以,build时又不行了。。 |
查了下原因,插件报错位置:https://github.com/ElementUI/babel-plugin-component/blob/master/src/core.js#L85 我的情况是nuxt的plugins中引入了axios和element-ui: plugins: [
'~/plugins/element-ui.js',
'~/plugins/axios.js',
], 在axios.js中单独引入了Message,在element-ui.js中是全量引入的。 plugins: [
'~/plugins/axios.js',
'~/plugins/element-ui.js',
], 就可以了,怀疑这里的plugin是逆序加载的,真实情况没有深究,知道的同学请告诉我一下。 |
是不是没人维护这个插件了呀? |
我是删除了.babelrc 下的plugins/component解决的。 |
相同场景:多入口,一个入口全量依赖、一个入口按需加载。 |
我也是 |
have you tried restart |
如题,我近期用到了elementui,因为觉得很好用,就把我之前项目整个替换成该UI库,但是现在遇到一个问题,希望各位大大给点帮助,因为网络上实在没有找到相关问题。
我的项目里有两个入口文件,index.js和login.js,对应两个html。
因为登录页只用到少许组件,所以我就想在login页使用babel-plugin-component这个插件,但index.js里是照常引入。
import Vue from 'vue';
import ElementUI from 'element-ui';
Vue.use(ElementUI);
这个时候babel-plugin-component就会报错
ERROR in ./src/app.js
Module build failed: Error: C:/Users/kuo/Desktop/vue-projects/gk/src/app.js: [babel-plugin-component] If you are using bothon-demand and importing all, make sure to invoke the importing all first.
at importMethod (C:\Users\kuo\Desktop\vue-projects\gk\node_modules\babel-plugin-component\lib\core.js:103:21)
请问有什么配置或方法是可以动态使用babel-plugin-component这个插件的吗?感激不尽。
The text was updated successfully, but these errors were encountered: