Project version check
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.
npm i -D unplugin-version-check
type | status |
---|---|
vite | ✅ |
webpack | ✅ |
rspack | ✅ |
vite.config.js
import versionCheck from 'unplugin-check-version/vite'
export default {
plugins:[versionCheck(/*option*/)]
}
webpack.config.js
const versionCheck = require('unplugin-check-version/webpack')
module.exports = {
plugins:[versionCheck.default(/*option*/)]
}
rspack.config.js
const versionCheck = require('unplugin-check-version/rspack')
module.exports = {
plugins:[versionCheck.default(/*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 |