您的位置:首页 > Web前端 > JavaScript

webpack ^4.0.1 版本的webpack.config.js配置

2018-03-02 16:06 671 查看
var path = require("path");
module.exports = {
entry:'./app/index.js',
output:{
filename:'index.js',
path:path.resolve(__dirname,'dist'),
publicPath:'temp/'                       //公共路径,从内存中读取
},
devServer:{
contentBase:'./',
host:'localhost',
compress:true,
port:1818
},
module:{
rules:[
{
test:/\.js$/,
exclude:/node_modules/,
loader:'babel-loader',
options:{
presets:["es2015","react"]
}
}
]
}
}
以上是webpack ^4.0.1 版本的webpack.config.js文件的配置
参考官方文档  https://webpack.js.org/configuration/#options 我的目录及文件





内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签:  webpack react