【发布时间】:2019-03-18 16:55:10
【问题描述】:
我想根据特定条件更改我的export { default } from 'MyFile',那么我可以用字符串变量替换文件吗?
目前我有这样的事情:
let exportFrom
if(SOME_CONDITION) {
exportFrom = '../Something/Blah'
} else {
exportFrom = './SomethingElse'
}
export { default } from exportFrom
这目前不起作用:
解析错误:意外的令牌
有没有办法做到这一点?
【问题讨论】:
-
你看MDN documentation了吗?它列出了
export default expression;。
标签: javascript ecmascript-6 es6-modules next.js