导入然后导出es6语法

时间:2015-12-13 23:59:48

标签: javascript import export ecmascript-6

基本ES6导入/导出语法问题。为方便起见,我有一个文件正在导入一堆其他文件。然后,模块可以只包含一个文件来访问所有信息,而不是为每个文件分别导入。

以下是它的设置方式:

core.js

import C from './constants'
import E from './events'
import L from './lang_en'
// ... etc.

// console.log() on C, E, L here all confirm that they're 
// available. They were exported from the constants.js, events.js files 
// like: `export default { C };`

现在,我希望能够做到这一点 myFile.js

import { C, E, L } from './core';

问题是core.js文件中的语法:我在es6导出语法上尝试了很多变体,但是没有一个允许导入行,如module.js所示。任何的想法?

0 个答案:

没有答案