support babel-plugin-import #13
Comments
I confirm this issue. Babel-plugin-import for antd https://github.com/ant-design/ant-design used to work ok but now seems broken in Meteor. |
Ok, I have the repo source. Let me see what I can do. I am actually working on bringing babili support to Meteor, per meteor/meteor#8379. I think meteor-babel is setup to honor your babelrc file. If not, while I am working on the Meteor core, I can see if they will let me expose a configuration object from the babel-compiler package to allow users to use their own plugins. |
So, an update on this, if MDG thinks it's a good idea, I could possibly add support via features for Babel plugin imports. Honoring babelrc is not an option though, because that breaks the whole package. |
In the latest meteor-babel index.js, i find that actually reifyCompiler is utilizing babel parser with strict limited plugins: |
I'm not 100% sure honestly, this is my first experience with reify. |
Sorry for the long wait, and for not having a great answer yet. I've been working on this problem lately by attempting to turn the Reify compiler into a Babel plugin. If that works, then it should be easier for custom Babel plugins to run before (or after) the Reify compiler, since it will no longer be a magical thing that happens independently. |
The most important change in this version is that the Reify compiler is now just another Babel plugin, so it's possible for other Babel presets and plugins to run before it. Fixes #8399. Fixes #8422. Fixes meteor/babel#13.
If you run |
Hi @benjamn |
I can confirm Meteor 1.4.3.2 works with babel-plugin-import. But Meteor 1.4.4.1 doesn't. @matteosaporiti has reproduction repo above. Someone reopen this issue please. |
@ucokfm @benjamn please reopen this issue per #13 (comment) and #13 (comment). I can confirm that v1.4.4.2 doesn't work either. |
Update: still broken in 1.4.4.3 and 1.5. |
@benjamn |
I appreciate your frustration, I really do, but I'm honestly not sure when we're going to have time to improve compatibility with In the meantime, I would strongly encourage you to ask yourselves if writing import Button from "antd/lib/button"; is really more trouble than writing import { Button } from 'antd'; considering that the second version relies on special plugin magic to work. You can (and I think should) go ahead and start making changes like that, and then you won't be dependent on |
@benjamn Thank you for your response. I understand resolving this issue would have low priority if it was just about preference of import format. The problem however is not about writing the import one or the other way. If it was just about this, the second one is just a little bit more comfortable. The reason to use babel-plugin-import is because it imports just the css required by components actually used in your project, instead of bundling the whole antd css file, which is rather large to send down the lines to clients |
@benjamn Thanks for taking the time to explain the quirks of
And that is what I'm using in production with no problem. |
@benjamn Any updates on it? please reopen |
This comment has been minimized.
This comment has been minimized.
Same problem here. Any update ? |
2 similar comments
Same problem here. Any update ? |
Same problem here. Any update ? |
same problem . Any update ? |
After long tries, I moved client-side meteor code to |
Same problem here. Any update ? |
@matteosaporiti Now in 2021, is babel-plugin-import not available in meteor? Is this a problem that can't be solved and can only be used like this
|
Our plan is to solve this issue with Tree-shaking PR. So you could import the lib from the root but tree-shaking would prevent your bundle to have everything. |
When using meteor and antd (a react components framework), we need to use babel-plugin-import to convert this code:
into
It was working with meteor-babel@0.13.0, but now it's not working (meteor-babel@0.14.4). I guess it because now meteor-babel will compile first using reifyCompiler and then pass the result to babel, while in v0.13.0 babel compile first and then pass the result to reify.
Is it possible to make reify not transpile specific module (like antd)? so babel will take the responsible to transpile it using babel-plugin-import?
The text was updated successfully, but these errors were encountered: