Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 3 additions & 4 deletions client/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,9 @@
"version": "0.0.0",
"type": "module",
"scripts": {
"dev": "npm run update-sw-version && vite",
"build": "npm run update-sw-version && vite build --emptyOutDir",
"preview": "vite preview",
"update-sw-version": "node scripts/update-sw-version.js"
"dev": "vite",
"build": "vite build --emptyOutDir",
"preview": "vite preview"
},
"devDependencies": {
"@sofie-automation/code-standard-preset": "^2.5.2",
Expand Down
19 changes: 0 additions & 19 deletions client/scripts/update-sw-version.js

This file was deleted.

2 changes: 1 addition & 1 deletion client/src/lib/sw-version.js
Original file line number Diff line number Diff line change
@@ -1 +1 @@
export const SW_VERSION = '2026-02-03T14:13:28.664Z' // Updated at build time
export const SW_VERSION = '__BUILD_VERSION__' // Generated at build time
2 changes: 1 addition & 1 deletion client/src/service-worker.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
const SW_VERSION = '2026-02-03T14:13:28.664Z' // Updated at build time
const SW_VERSION = '__BUILD_VERSION__' // Generated at build time

let requestId = 0
const requestMap = new Map()
Expand Down
9 changes: 8 additions & 1 deletion client/vite.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@ import { nodePolyfills } from 'vite-plugin-node-polyfills'
import { defineConfig } from 'vite'
import { buildSync } from 'esbuild'

// import react from '@vitejs/plugin-react'
// Generate version once for entire build to ensure sync between main bundle and service worker
const BUILD_VERSION = new Date().toISOString()

export default defineConfig({
root: path.resolve(__dirname, 'src'),
Expand All @@ -28,6 +29,9 @@ export default defineConfig({
outDir: '../dist',
},
base: '/',
define: {
'__BUILD_VERSION__': JSON.stringify(BUILD_VERSION),
},

plugins: [
// ...
Expand All @@ -42,6 +46,9 @@ export default defineConfig({
bundle: true,
entryPoints: [path.join(process.cwd(), 'src/service-worker.js')],
outfile: path.join(process.cwd(), 'dist/service-worker.js'),
define: {
'__BUILD_VERSION__': JSON.stringify(BUILD_VERSION),
},
})
},
},
Expand Down
Loading