const path = require('path');
module.exports = {
mode:'development',
entry: './src/index.js',
output: {
// 虚拟路径名字
publicPath:'dist',
filename: 'bundle.js',
},
devServer:{
port:8080,
// contentBase:"www"
// 静态文件路径
static:"www" // contentBase 修改成 static
}
};
以前webpack4的时候配置devServer中用的是contentBase:“www”;
webpack5需要替换成 static:“www”
这篇博客主要介绍了在从Webpack4升级到Webpack5的过程中,配置项`devServer.contentBase`的使用方式发生了变化,现在需要替换为`static`。这个更改影响了开发服务器如何提供静态文件。确保在Webpack5配置中正确设置`static`字段,以保持开发环境的正常运行。
1640

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



