參考: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)