Search code examples
compilationjsxbabeljsbabel-cli

Babel --out-file in a child folder


I am trying to compile jsx with babel. I can do it but I want to set --out-file in a child dir. There is I want to do:

website
  src
    file_will_be_compiled.js
    file_was_compiled.js
  package.json

The script I am running on the shell :

babel --watch src/file_will_be_compiled.js --out-dir src --plugins @babel/plugin-transform-react-jsx

Solution

  • Ok, I solved. The new shell code:

    babel --watch src/file_will_be_compiled.js --out-file src/compiled_file.js --presets preset-react