Is there any one-line analogy in ES6 for ES5 `module.exports = require('./inner.js')`?

前端 未结 1 1733
小蘑菇
小蘑菇 2020-11-27 21:57
// before
module.exports = require(\'./inner.js\');
// nowadays
export default from \'./inner.js\';

i\'m trying to do this, but babel allow it only

相关标签:
1条回答
  • 2020-11-27 22:00

    You should be able to do

    export {default as default} from './inner.js';
    // or even
    export {default} from './inner.js';
    

    with current ES6 semantics.

    However I don't think there's anything wrong with using the ES next proposal, I'm pretty confident that it will make it into ES7 ES8.

    0 讨论(0)
提交回复
热议问题