-
My repo to log and store my current work with JS. This includes two source folders, one containing ES6 called src, and the other called lib containing ES5 generated using the JavaScript transcompiler Babel.
-
Directory src/work includes interview prep questions in ES6.
If you would like to see how compatable our ES6 to Babel's ES5 is, you can simple run the index.html file with an extension like Live Server for VS Code.
For future reference, here is a list of the steps needed to set up the project for transpilation:
-
Initialize your project using npm init and create a directory called src
-
Install babel dependencies by running
npm install babel-cli -D
npm install babel-preset-env -D
- Create a .babelrc file inside your project and add the following code inside it:
{
"presets": ["env"]
}
- Add the following script to your scripts object in package.json:
"build": "babel src -d lib"
- Run npm run build whenever you want to transpile your code from your src to lib directories.