Skip to content

Commit 057d638

Browse files
committed
dates are added
1 parent 759c0b9 commit 057d638

File tree

3 files changed

+57
-1
lines changed

3 files changed

+57
-1
lines changed

package.json

+1
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
},
1818
"devDependencies": {
1919
"@biomejs/biome": "1.6.4",
20+
"@rollup/plugin-replace": "^5.0.5",
2021
"@types/react": "^18.2.66",
2122
"@types/react-dom": "^18.2.22",
2223
"@typescript-eslint/eslint-plugin": "^7.2.0",

pnpm-lock.yaml

+43
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

vite.config.ts

+13-1
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,21 @@
11
import react from "@vitejs/plugin-react-swc";
2-
import { defineConfig } from "vite";
2+
import { Plugin, defineConfig } from "vite";
33
import { VitePWA } from "vite-plugin-pwa";
4+
import replace from '@rollup/plugin-replace'
5+
6+
const replaceOptions = { __DATE__: new Date().toISOString() }
7+
// const claims = process.env.CLAIMS === 'true'
8+
const reload = process.env.RELOAD_SW === 'true'
9+
// const selfDestroying = process.env.SW_DESTROY === 'true'
10+
if (reload) {
11+
// @ts-expect-error just ignore
12+
replaceOptions.__RELOAD_SW__ = 'true'
13+
}
414

515
// https://vitejs.dev/config/
616
export default defineConfig({
717
plugins: [
18+
replace(replaceOptions) as Plugin,
819
react(),
920
VitePWA({
1021
// registerType: "autoUpdate",
@@ -41,6 +52,7 @@ export default defineConfig({
4152
enabled: true,
4253
},
4354
}),
55+
4456
],
4557
base: "/react_pwa/",
4658
});

0 commit comments

Comments
 (0)