PWA fixed
added systemd service howto traefik nginix set_real_ip_from improved readme visuals fixed on mobile labels removed updated readme fixed visuals overlay for the hotkey disable screen lock clean up git precommit hooks clean up clean up update check for update feature added build-time information fixed date
This commit is contained in:
61
vite.config.js
Normal file
61
vite.config.js
Normal file
@@ -0,0 +1,61 @@
|
||||
import { defineConfig } from 'vite';
|
||||
import vue from '@vitejs/plugin-vue';
|
||||
import fs from 'fs';
|
||||
import { resolve } from 'path';
|
||||
|
||||
const packageJson = JSON.parse(fs.readFileSync('./package.json', 'utf8'));
|
||||
const appVersion = packageJson.version;
|
||||
|
||||
const now = new Date();
|
||||
const dateTimeFormat = new Intl.DateTimeFormat('sk-SK', {
|
||||
year: 'numeric', month: '2-digit', day: '2-digit',
|
||||
hour: '2-digit', minute: '2-digit', second: '2-digit',
|
||||
hour12: false
|
||||
});
|
||||
|
||||
const parts = dateTimeFormat.formatToParts(now);
|
||||
let day = '', month = '', year = '', hour = '', minute = '', second = '';
|
||||
|
||||
parts.forEach(part => {
|
||||
switch (part.type) {
|
||||
case 'day': day = part.value; break;
|
||||
case 'month': month = part.value; break;
|
||||
case 'year': year = part.value; break;
|
||||
case 'hour': hour = part.value; break;
|
||||
case 'minute': minute = part.value; break;
|
||||
case 'second': second = part.value; break;
|
||||
}
|
||||
});
|
||||
|
||||
// Assemble the date part without unwanted spaces
|
||||
const appBuildTime = `${day}.${month}.${year} ${hour}:${minute}:${second}`;
|
||||
|
||||
export default defineConfig({
|
||||
plugins: [vue()],
|
||||
server: {
|
||||
port: 8080
|
||||
},
|
||||
define: {
|
||||
'import.meta.env.VITE_APP_BUILD_TIME': JSON.stringify(appBuildTime),
|
||||
'__APP_CACHE_VERSION__': JSON.stringify(`nexus-timer-cache-v${appVersion}-${Date.now()}`)
|
||||
},
|
||||
build: {
|
||||
rollupOptions: {
|
||||
input: {
|
||||
main: resolve(__dirname, 'index.html'),
|
||||
sw: resolve(__dirname, 'src/sw.js')
|
||||
},
|
||||
output: {
|
||||
entryFileNames: assetInfo => {
|
||||
if (assetInfo.name === 'sw') {
|
||||
return 'service-worker.js';
|
||||
}
|
||||
return 'assets/[name]-[hash].js';
|
||||
},
|
||||
chunkFileNames: 'assets/[name]-[hash].js',
|
||||
assetFileNames: 'assets/[name]-[hash].[ext]',
|
||||
}
|
||||
},
|
||||
emptyOutDir: true,
|
||||
}
|
||||
});
|
||||
Reference in New Issue
Block a user