umijs / babel-plugin-import

Modularly import plugin for babel.
3.16k stars 405 forks source link

babel-plugin-import crashes babels typescript plugin #188

Open drcmda opened 7 years ago

drcmda commented 7 years ago

https://github.com/babel/babel/issues/6093#issuecomment-343900526

The error could be with Babel, but i wonder why this plugin changes import names at all from something like 'Button' to '_button'. I don't think it would be a problem otherwise.

Also is there a reason why components do not simply fetch their own css? If they did, webpack could easily treeshake and the plugin wouldn't be needed any longer.

afc163 commented 7 years ago

You can try https://github.com/Brooooooklyn/ts-import-plugin/

drcmda commented 7 years ago

@afc163 as of babel 7 typescript can be run without taking over transpilation, via @babel/preset-typescript. Our build system is babel based. I'm just wondering why the names are changed (Button -> _button), because i think without it, it would already work. Or why there is the need for a plugin at all when each component could basically import its own style fragment. Was this done to support less in production?