1
ES6 /巴贝尔:我的文件夹看起来是这样的:的javascript:的ReferenceError:出口没有定义
A/
index.js
a.js
...other
我通过index.js
文件揭露a.js
内容如下:
export { foo, bar } from './a';
所以我可以使用它导入它:
import { foo, bar } from '../A';
但现在,我想在index.js
使用*
,这样的情况下,我从a.js
出口的另一件事,就自动曝光:
export * from './a';
但是当我这样做,我得到这个错误:
Uncaught ReferenceError: exports is not defined
我在这里做错了什么?
@Andy你能否澄清一下 –
@Andy显然OP所使用的环境确实理解了导入/导出,因为它只有在使用'expor t * from'that that there is a error:p –
你必须使用像babel或traceur这样的转译器将它转换为ES2015 – Niladri