我有以下结构
components/
index.js
Messages/
index.js
error.jsx
info.jsx
success.jsx
Messages / index.js将这三条消息导出为:
export {Info} from './info'
export {Error} from './error'
export {Success} from './success'
component / index.js执行以下操作:
import * as Message from './Message'
export {Message}
如果没有导入,我有办法吗?
我正在使用webpack和Babel与es2015预设
答案 0 :(得分:2)
根据Mozilla的ES2015文档https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/export,你可以做到
export * from './Messages';