-
Notifications
You must be signed in to change notification settings - Fork 405
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
import { Component } from 'antd' does not work. #204
Comments
No one out there? :( |
Reproduce repo. |
https://github.com/eminx/Nodal See the importing of
If you want to reproduce, just remove the Thanks! |
For example in this file: https://github.com/eminx/Nodal/blob/master/client/UIComponents/CardArticle.jsx |
update your react and react-dom 16 + |
react and react-dom are all 16.2.0. But I also have the same Reference Error of any Component I tried to use. Probably Meteor and babel-plugin-import is not compatible for some reason. As I see @eminx is using Meteor framework also. |
Exactly. @gchansc Do you also use meteor? In that case it must be related to it. The weird thing is everything was working fine in the beginning. This all happened at some ambiguous point. Fortunately I found the work around with |
@eminx Yes. I'm testing Meteor with antd. Then I ran into this issue. Seems the current workaround is to add /lib when import. Happy coding! ^^ |
It's clear that problem with meteor builder. Try to build client code separetely on your host and give us feedback. |
Since this is an issue that has to do with Meteor, and not antd, I'm closing it. |
Hello! After almost three years I'm reopening the same issue :) Basically I get why we need to do the
But unfortunately the treeshaking itself is not working. Because well, I'm using only a few icons and it seems like they are over 1mb in the bundle! How to make this tree-shaking work on Meteor so the bundle is for humans? |
with import { createApp } from "vue";
import App from "./App.vue";
import Antd from "ant-design-vue";
import "ant-design-vue/dist/antd.css";
const app = createApp(App);
// components
app.use(Antd);
// mount
app.mount('#app'); with import { createApp } from "vue";
import App from "./App.vue";
import Antd from "ant-design-vue/lib";
import "ant-design-vue/dist/antd.css";
const app = createApp(App);
// components
app.use(Antd);
// mount
app.mount('#app'); UPD: |
The plugin imports don't seem to work.
In my code:
import { Layout } from 'antd';
It gives the error:
ReferenceError: Layout is not defined.
When I change my code to:
const Layout = require('antd').Layout;
it works.
Can someone please help me fix that? This started out of nothing...
The text was updated successfully, but these errors were encountered: