I defined a javascript file as below:
export default {
parseOptions: {
tolerant: true,
raw: true,
tokens: true,
range: true,
comment: true,
},
syntaxType: {
callback: 'callback',
promise: 'promise',
await: 'await',
},
};
I use below code to import it in other files:
import { syntaxType } from './options';
...
synaxType.callback
I get an error that synaxType
is not defined when I use it. However if I change to below code it will work fine:
import options from './options';
options.synaxType.callback
I wonder what wrong with my previous import. Do I need to configure anything for that? Below is my babel configuration:
{
"presets": [
["es2015"],
"stage-0",
"react",
"react-boilerplate"
],
"plugins": [
"transform-decorators-legacy",
"transform-class-properties",
"transform-async-to-generator",
"react-hot-loader/babel"
]
}