Detect webpage updates and notify user to reload. support Nuxt.
# use yarn (recommend)
yarn add -D nuxt-web-update-notification
# or use npm
npm install --save-dev nuxt-web-update-notification
// nuxt.config.js
export default {
mode: 'universal',
env: {
PATH_TYPE: process.env.PATH_TYPE,
},
/*
** Nuxt.js modules
*/
modules: [
[
'nuxt-web-update-notification',
{
logVersion: true,
checkInterval: 5 * 60 * 1000, // 5 分钟设置轮询一次
// 在某些环境下才开启该 Module
shouldBeEnable: (options) => {
if (options.env.PATH_TYPE === 'trial') {
return true;
}
return false;
},
},
],
],
};