Is it possible to export the result of “import * as” in ES2015?

后端 未结 1 1176
没有蜡笔的小新
没有蜡笔的小新 2021-02-14 05:13

In ES2015, it\'s possible to import an entire module as an object whose properties are the module\'s exports:

import * as name from \'module\';

相关标签:
1条回答
  • 2021-02-14 05:40

    No, this was simply missed in ES6. There is a stage 1 proposal to add these, though, and rollup will consider implementing it.

    Until then, you will need to use two declarations and a local binding, altough there's no need to clone the object:

    import * as name from 'module';
    export { name };
    
    0 讨论(0)
提交回复
热议问题