I have been running a command to turn .jsx files into .js files one at a time:
npx babel App.jsx --out-file App.js --plugins=@babel/plugin-transform-react-jsx
I want to do it for everything in a directory. I read through the help command’s options and it seems like I should be able to do this
npx babel -d mydirectory -x .jsx --plugins=@babel/plugin-transform-react-jsx
But that says it requires filenames, despite providing a directory.
What’s the right syntax to get this to work?
Advertisement
Answer
According to babel docs, it appears the syntax is
npx babel mydirectory --out-dir dist -x .jsx --plugins=@babel/plugin-transform-react-jsx