Uncaught SyntaxError: Unexpected Token Export

I used the create-responsive-app for my project. I get an error

Inactive SyntaxError: Unexpected Token Export

Error in this code

export const ENGLISH = { lang: 'en', messages: { 'nav.translatedMessage': 'Social', } }; 

I tried installing babel-preset-es2015 and babel-preset-stage-0. I also included babel dict / object in package.json as

 "babel": { "presets": [ "es2015", "stage-0" ] }, 

I am still getting the error message.

enter image description here

+6
source share
2 answers

I got my answer to the README.md of the create-react-app application. It says:

You can create subdirectories inside src . For faster rebuilds, only files inside src processed by Webpack.
You need to place any JS and CSS files inside src , or Webpack will not see them.

+6
source

I think because of the comma

 export const ENGLISH = { lang: 'en', messages: { 'nav.translatedMessage': 'Social' } }; 

Try to do it!

-5
source

Source: https://habr.com/ru/post/1012576/


All Articles