【发布时间】:2018-10-18 08:23:04
【问题描述】:
在我最近安装的许多 npm 模块中(例如@material-ui/core),有三种方法可以导入相同的 React 组件:
import { AppBar } from '@material-ui/core'
import AppBar from '@material-ui/core/AppBar/AppBar'
import AppBar from '@material-ui/core/es/AppBar/AppBar'
在什么情况下应该使用variant 3 / es6导出文件?
如果
tree-shaking/dead code elimination在 webpack 和 npm 模块中工作。我应该使用变体 1(命名导入)而不是变体 2(默认导出)吗?
【问题讨论】: