wix-incubator / react-templates

Light weight templates for react
https://wix.github.io/react-templates
MIT License
2.82k stars 207 forks source link

rt-import several non-default exported module items #202

Open amireldor opened 7 years ago

amireldor commented 7 years ago

I can't seem to find this anywhere I searched, and the only thing I managed to get working seems a bit strange to me. How would I produce imports like these:

import {cat, dog} from "horse";

I could do so with <rt-require dependency="horse" as="{cat, dog}"/>, but couldn't figure out how to with <rt-import>.

All I could come up with is using multiple instructions:

<rt-import from="horse" name="cat"/>
<rt-import from="horse" name="dog"/>

But that seems strange to me as it seeme like a step backwards in usability since rt-require.

nippur72 commented 7 years ago

from what I remember, rt-require doesn't work with the object destructuring syntax {cat, dog}... unless perhaps you target ES6... do you?

And yes, destructuring is not supported by rt-import either, but that's an idea for improvement.