安装 babel-register 与 babel-preset-es2015
yarn add babel-register babel-preset-es2015 --dev
创建index.js,将app.js引入
//index.js
require('babel-register') ({
presets: [ 'es2015' ]
})
module.exports = require('./app.js')
安装 babel-register 与 babel-preset-es2015
yarn add babel-register babel-preset-es2015 --dev
创建index.js,将app.js引入
//index.js
require('babel-register') ({
presets: [ 'es2015' ]
})
module.exports = require('./app.js')