Skip to content

CoutinhoTTS/unplugin-version-check

Repository files navigation

unplugin-version-check

NPM version

Project version check

Why

When we are using a website and a new version is released, we need to notify the user that a new version of the site is available. Our project might be built with different frameworks and build tools, with common ones including Vite, Webpack, and Repack. We can install a plugin during the build process that supports various build tools, making it easier for the site to detect version updates.

Install

npm i -D unplugin-version-check 

Support

type status
vite
webpack
Rspack rspack

Use

vite

vite.config.js

import versionCheck from 'unplugin-check-version/vite'
export default {
    plugins:[versionCheck(/*option*/)]
}

webpack

webpack.config.js

const versionCheck = require('unplugin-check-version/webpack')
module.exports = {
    plugins:[versionCheck.default(/*option*/)]
}

rspack

rspack.config.js

const versionCheck = require('unplugin-check-version/rspack')
module.exports = {
    plugins:[versionCheck.default(/*option*/)]
}

Option

interface Position {
  top?: string | number
  bottom?: string | number
  left?: string | number
  right?: string | number
}
Name Description Type Default
systemName system name string systemName
time Interval trigger time number 30000
position dialog location Position --
title dialog title string Discover new version
describe dialog describe string Detected a new version of the system, please update!
btnText dialog button text string Update now
overlay dialog overlay boolean true