webpack webpack.config.js配置文件
module.exports = { entry: './es6.js', // 入口文件路径 output: { filename: "./main.js", }, module: { loaders: [ { test: /\.js$/, // babel 转换为兼容性的 js exclude: /node_modules/, loader: 'babel-loader', query: {presets: ['latest']} } ] }}
package.json依赖安装包
{ "dependencies": { "babel-core": "^6.25.0", "babel-loader": "^7.1.1", "babel-preset-latest": "^6.24.1" }}