0

I have the following structure

 components/
   index.js
   Messages/
    index.js
    error.jsx
    info.jsx
    success.jsx 

Messages/index.js export the three messages as :

export {Info} from './info'
export {Error} from './error'
export {Success} from './success'

And components/index.js does the following:

 import * as Message from './Message'
 export {Message}

Is there a way for me to do it without the import?

I am using webpack and Babel with es2015 presets

FabioCosta
  • 3,069
  • 6
  • 28
  • 50

1 Answers1

3

According to Mozilla's ES2015 documentation https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/export you can just do

export * from './Messages';
Alex Moldovan
  • 2,336
  • 1
  • 16
  • 14
  • Yeah that kinda worked, the only caveat is that i need to wrap the Message on Message/index.js So i can Use Message.Info and not just Info – FabioCosta Feb 24 '16 at 19:48