@@ -3,9 +3,8 @@ import { defineConfig } from 'vite'
33import react , { reactCompilerPreset } from '@vitejs/plugin-react'
44import babel from '@rolldown/plugin-babel'
55import tailwindcss from '@tailwindcss/vite'
6- import { VitePWA as pwa } from 'vite-plugin-pwa'
7-
8- const name = 'RadixVerse'
6+ // import { VitePWA as pwa } from 'vite-plugin-pwa'
7+ import { serwist } from '@serwist/vite'
98
109export default defineConfig ( {
1110 base : process . env . BASE_URL ?? '/' ,
@@ -18,36 +17,19 @@ export default defineConfig({
1817 react ( ) ,
1918 babel ( { presets : [ reactCompilerPreset ( ) ] } ) ,
2019 tailwindcss ( ) ,
21- pwa ( {
22- devOptions : { enabled : true } ,
23- injectRegister : 'script' ,
24- registerType : 'autoUpdate' ,
25- includeAssets : [ 'images/*.{ico,png}' ] ,
26- manifest : {
27- name,
28- short_name : name ,
29- display : 'standalone' ,
30- theme_color : '#f1f1f1' ,
31- background_color : '#f1f1f1' ,
32- icons : [ {
33- src : 'images/icon-64x64.png' ,
34- sizes : '64x64' ,
35- type : 'image/png' ,
36- } , {
37- src : 'images/icon-192x192.png' ,
38- sizes : '192x192' ,
39- type : 'image/png' ,
40- } , {
41- src : 'images/icon-512x512.png' ,
42- sizes : '512x512' ,
43- type : 'image/png' ,
44- } , {
45- src : 'images/icon-512x512.png' ,
46- sizes : '512x512' ,
47- type : 'image/png' ,
48- purpose : 'maskable' ,
49- } ]
50- }
51- } )
20+ // pwa({
21+ // devOptions: { enabled: true },
22+ // injectRegister: 'script',
23+ // registerType: 'autoUpdate',
24+ // includeAssets: [ 'images/*.{ico,png}' ],
25+ // manifest:
26+ // })
27+ serwist ( {
28+ swSrc : 'src/sw.ts' ,
29+ swDest : 'sw.js' ,
30+ globDirectory : 'dist' ,
31+ injectionPoint : 'self.__SW_MANIFEST' ,
32+ rollupFormat : 'iife' ,
33+ } ) ,
5234 ]
5335} )
0 commit comments