一、安装
yarn add @plugin-web-update-notification/webpack -D
二、配置
public/index.html
<meta http-equiv="Cache-Control" content="no-cache, no-store, must-revalidate" />
<meta http-equiv="Pragma" content="no-cache" />
<meta http-equiv="Expires" content="0" />
vue.config.js
const { WebUpdateNotificationPlugin } = require('@plugin-web-update-notification/webpack')
configureWebpack: {
plugins: [
new WebUpdateNotificationPlugin({
logVersion: true,
checkInterval: 1000 * 3,
notificationConfig: { placement: 'topRight' }
})
]
},
三、打包
npm run build
四、使用http-server运行dist/index.html
http-server -p 5008
五、改变web_version_by_plugin.json中的version
可以看到弹框提示