var square = (n) => n * n
"use strict";
var square = function (n) {
return n * n;
};
ES6
ES7
JSX
...
{
"plugins": [
"check-es2015-constants",
"transform-es2015-arrow-functions",
"transform-es2015-block-scoped-functions",
"transform-es2015-block-scoping",
"transform-es2015-classes",
"transform-es2015-computed-properties",
"transform-es2015-destructuring",
"transform-es2015-duplicate-keys",
"transform-es2015-for-of",
"transform-es2015-function-name",
"transform-es2015-literals",
"transform-es2015-modules-commonjs",
"and 9 other plugins"
]
}
{
"plugins": [],
"presets": ["es2015"]
}
Parse
Traverse & Transform
Generate
Plugins
var greeting = "Hello"
var greeting = "Hi";
var greeting = "Hello"
module.exports = function(babel) {
return {
visitor: {
Literal: function(path) {
path.node.value = "Hi"
}
}
}
}
var greeting = "Hi";
// subfolder/app.js
import utils from "../utils"
console.log(utils);
// utils.js
export default "Successfully imported utils!"
import utils from "@/utils"
import utils from "./utils"
import utils from "../../utils"
Slides
Demo Code
Questions