DevServer---webpack的本地提升开发效率

inline: true, // 实时预览功能插入一个代理,代理客服端控制刷新(否则通过iframe)
hot: true// 模块热替换,从而实时预览
open: true, // 运行是自动打开网页
host: 127.0.0.0, // 默认是本地可以访问,可以设置其他设备访问
// 只有一个html是设置true,不论什么都返回index.html,
historyApiFallback: true,
devtool: 'cheap-source-map',// 开启代码检查
// 一个html
historyApiFallback: {
    index: `/${appName}/index.html`,
},
// 多个html
historyApiFallback: {
	// user开头=>user.html,game=> game.html
	rewrites: [
		{ from: /^\/user/,to:  `/${appName}/user.html` },
		{ from: /^\/game/,to: `/${appName}/game.html` },
		{ from: /./,to: `/${appName}/index.html` }
	],
},
compress: true, // 是否开启gzip压缩
https: false, // 是否设置签名之类的
cathe: false, // 是否使用缓存提升构建速度
watch: true, // 是否开启监听
watchOptions: {
	ignored: /node_modules/,
	aggregateTimeout: 300(默认),	// 文件变化多久执行,截流
	poll: 1000, // 轮询
}
proxy: {
	'/api': 'http://lockalhost:3000'
}, 
contentBase: path.join(__dirname, '..dist')// http文件根目录
 publicPath: `/${appName}/`,	// 设置跟output一致
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值