I’m converting a Meteor app to raw Node.js app with ‘react-redux-starter-kit’ which include Webpack. And I’ve added ‘lodash-es’ in the project as a dependancy to use es6 syntax. After that, when I transpile the project, the error message ‘unexpected token import’ comes up.
According to Babel.js , it is a bug when you try to transpile code like below with transform-runtime.
export * from 'x'
And here is the workaround for me.
npm install --save-dev babel-preset-es2015
.babelrc
{
"passPerPreset": true,
"presets": ["es2015"]
}
refer:
https://www.google.co.kr/search?q=import+_Object%24defineProperty+from+%27babel-runtime%2Fcore-js%2Fobject%2Fdefine-property%27%3B&oq=import+_Object%24defineProperty+from+%27babel-runtime%2Fcore-js%2Fobject%2Fdefine-property%27%3B&aqs=chrome..69i57.1553j0j7&sourceid=chrome&ie=UTF-8
https://github.com/babel/babel-loader/issues/195#issuecomment-246900259
https://github.com/babel/babel/issues/2877#issuecomment-245402025
https://www.google.co.kr/webhp?sourceid=chrome-instant&ion=1&espv=2&ie=UTF-8#q=babel+js+unexpected+token+import&*
http://stackoverflow.com/questions/35040978/babel-unexpected-token-import-when-running-mocha-tests