Solution: ‘import’ and ‘export’ may appear only with ‘sourcetype: module’

yarn add Babel - presets - 0-d
yarn add Babel - presets -env-d
then add to the root directory of .babelrc

 "presets": [
     "env",
     "react",
     "stage-0"
 ],

Can. Env and stage-0 are guaranteed to exist, env covers es2015,2016,2017, and is now also officially recommended.

Read More: