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 4.0.1版本的配置方法,包括入口文件设置、输出路径配置、开发服务器参数设定以及模块加载规则等。通过具体实例帮助读者更好地理解和使用Webpack。
2001

被折叠的 条评论
为什么被折叠?



