参考:https://www.slightedgecoder.com/2017/05/22/setting-es6-environment-asp-net-mvc-5/
创建 node 初始文件 package.json
npm init -y
安装 需要的包
npm install --save-dev webpack babel-core babel-loader babel-polyfill babel-preset-env
配置WebPack 文件 webpack.config.js
const path = require('path');
module.exports = {
entry: ['./Scripts/es6/main.js'],
output: {
path: path.resolve(__dirname, './Scripts/build'),
filename: 'bundle.js'
},
// IMPORTANT NOTE: If you are using Webpack 2 or above, replace "loaders" with "rules"
module: {
loaders: [{
loader: 'babel-loader',
test: /\.js$/,
exclude: /node_modules/
}]
}
}
配置网站属性 生成属性
npm run build --prefix $(ProjectDir)