risingPhoenix1979
risingPhoenix1979

Reputation: 1144

Update .babelrc to Add JavaScript File Paths to Transpile

I used Babel to transpile ES6 JavaScript to ES5 for:
https://hollyw00d.github.io/Accessible-ES6-JavaScript-Tabs/

I can't figure out how to update my .babelrc file to automatically transpile a specific ES6 file to a specific ES5 file.

What code do I add into my .babelrc file to do that? Is this even possible?

Here's the contents of my .babelrc file:

{
  "presets": [
    "@babel/preset-env",
    "minify"
  ]
}

Here's the command I do on my Mac's iTerm to transpile my ES6 file into my ES5 file:
npx babel ./assets/js/scripts.js --out-file ./assets/js/scripts.min.js

Here's the npm modules I've installed locally in the directory for this project:

├── @babel/[email protected]
├── @babel/[email protected]
├── @babel/[email protected]
├── [email protected]
└── [email protected]

Upvotes: 0

Views: 199

Answers (1)

loganfsmyth
loganfsmyth

Reputation: 161457

Babel's .babelrc files are for configuring what transformations to perform on given input files but do not cover what input files or what output files will be processed, so this is not possible.

Upvotes: 1

Related Questions