I'm defining two constants using keyMirror
from Facebook's fbjs
.
// file1.js
import keyMirror from 'fbjs/lib/keyMirror'
export default keyMirror({
CONST1: null,
CONST2: null,
})
then import them in file2.js
:
// file2.js
import { CONST1, CONST2 } from './file1'
console.log(CONST1) // undefined
their values can't be resolved. If I change file2.js
like so:
// file2.js
import constants from './file1'
console.log(constants.CONST1) // CONST1
it works fine. What's wrong with it? I'm using Babel 6 with babel-preset-es2015
to run the scripts.