添加链接
link之家
链接快照平台
  • 输入网页链接,自动生成快照
  • 标签化管理网页链接
Collectives™ on Stack Overflow

Find centralized, trusted content and collaborate around the technologies you use most.

Learn more about Collectives

Teams

Q&A for work

Connect and share knowledge within a single location that is structured and easy to search.

Learn more about Teams

In my particular case, I've tried both of the followings, they all work, wonder the underlying differences between them.

// echarts v5.0.0
export * as ECharts from 'echarts/lib/echarts.js'
export { default as ECharts } from 'echarts/lib/echarts.js'

babel.config.js

module.exports = {
  // "@vue/cli-plugin-babel": "~4.5.0",
  presets: ['@vue/cli-plugin-babel/preset'],
                They are absolutely not the same. They might have the same result depending on what foo exports (or further, what your transpiler or module loader does with it) - please post that as well.
– Bergi
                Jan 5, 2021 at 13:22
                Does this answer your question? Difference between import X and import * as X in node.js (ES6 / Babel)?
– marzelin
                Jan 5, 2021 at 13:45

This one exports all named exports and default export from foo as bar:

export * as bar from 'foo'

This one only exports default export from foo as bar:

export { default as bar } from 'foo'
        

Thanks for contributing an answer to Stack Overflow!

  • Please be sure to answer the question. Provide details and share your research!

But avoid

  • Asking for help, clarification, or responding to other answers.
  • Making statements based on opinion; back them up with references or personal experience.

To learn more, see our tips on writing great answers.