I am having a problem with configuring webpack for a react app.My main problem is around the issue of babel. | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

I am having a problem with configuring webpack for a react app.My main problem is around the issue of babel.

So far the command line is spitting out an error that it cannot understand the es6 arrow functions when I fire up the dev-server. Technically, for every es6 syntax, it is generating an error.There might be some some conflict between the different versions of babel presets with the babel-loader.And also are the babel-presets deprecated because I have looked into it and the the only configuration on presets which is allowed is @babel/preset-env.I am not so sure.So if anyone can guide me on what babel to install and the versions, I would be grateful

2nd Jun 2020, 5:18 AM
prime omondi
prime omondi - avatar
4 Answers
+ 2
Did you use create-react-app command for generating react boilerplate?
2nd Jun 2020, 5:27 AM
Raj Chhatrala
Raj Chhatrala - avatar
0
I didn't use create-react-app, I have started from scratch.Technically the app is working and it is listening on port 8080 but I cannot get to write any es6 syntax because the error from the command line suggests that it cannot understand es6.I have noted that it may be due to the babel installations.I just don't know how to resolve the versions so that they can be compartible with each other
2nd Jun 2020, 5:31 AM
prime omondi
prime omondi - avatar
0
It has finally worked, turns out some static class properties were not being parsed correctly.I have added a plugin and also installed the babel dependencies as devDependencies
2nd Jun 2020, 6:36 AM
prime omondi
prime omondi - avatar
0
Use npx create-react-app my-app to save all the troubles.
2nd Jun 2020, 7:36 AM
Calviղ
Calviղ - avatar