0a8464f63c
- Introduced version.json and appVersionAssetPlugin for build-time version tracking. - Enhanced settings page with update check/status UI. - Refactored bootstrap to handle SW updates and initiate periodic checks.
34 lines
672 B
JavaScript
34 lines
672 B
JavaScript
import { defineConfig } from 'vite';
|
|
import packageJson from './package.json';
|
|
|
|
function appVersionAssetPlugin() {
|
|
return {
|
|
name: 'app-version-asset',
|
|
apply: 'build',
|
|
generateBundle() {
|
|
this.emitFile({
|
|
type: 'asset',
|
|
fileName: 'version.json',
|
|
source: JSON.stringify(
|
|
{
|
|
version: packageJson.version,
|
|
buildTime: new Date().toISOString(),
|
|
},
|
|
null,
|
|
2,
|
|
),
|
|
});
|
|
},
|
|
};
|
|
}
|
|
|
|
export default defineConfig({
|
|
define: {
|
|
__APP_VERSION__: JSON.stringify(packageJson.version),
|
|
},
|
|
plugins: [appVersionAssetPlugin()],
|
|
server: {
|
|
port: 4173,
|
|
},
|
|
});
|