How to create the .babelrc file

Please help me, I stuck on the 3-rd exercise here :slight_smile:
ttps://www.codecademy.com/paths/web-development/tracks/front-end-applications-with-react/modules/learn-javascript-transpilation/lessons/browser-compatibility-and-transpilation/exercises/babel-configuration
When I click no “view solution” there is no real solution.
I might have further questions about this topic, but for now stuck on the 3rd.
Thank you in advance!

The difference in the solution is probably in the .babelrc.Screen Shot 2021-09-18 at 12.36.24 PM
Screen Shot 2021-09-18 at 12.36.27 PM

If you haven’t created .babelrc you can run touch .babelrc or directly nano .babelrc or vi .babelrc (depending on your editor of choice).

tyvm for the answer!
I am still lost
I try to do that on codecademy editor.
But I cannot get that .babelrc file.
Could you please give me the steps for codecademy?
Thank you in advance! :slight_smile:

Thank you very much again!
Looks like I missed that touch.babelrc command.
So it must be:

  1. npm init -y … for creating package.json file
  2. {“build”: “babel src -d out”} to be written in the “scripts” section in package.json file
  3. touch .babelrc -creates .babelrc file
  4. { “presets” : [“@babel/preset-env”]} to be written in the .babelrc file
  5. npm run build

When I write npm init -y, I get not only package json file but test,js file also in the test folder. How could that happen?
Thank you again!

Hi,

I’m only going to speculate here. When you look into that test.js file you see all the error messages for the exercise (that is, it’s executing some cc platform-specific error detection script). It isn’t part of the actual exercise.

Thank you very much for your answers!
You helped me a lot!