Skip to content

Commit

Permalink
Add VitePWA
Browse files Browse the repository at this point in the history
  • Loading branch information
HamzaJarane committed Jul 20, 2024
1 parent 0579d29 commit 4e1268d
Show file tree
Hide file tree
Showing 3 changed files with 2,211 additions and 16 deletions.
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,8 @@
"react-contexify": "^6.0.0",
"react-dom": "^18.3.1",
"react-gsap": "^3.2.1",
"styled-components": "^6.1.11"
"styled-components": "^6.1.11",
"vite-plugin-pwa": "^0.20.0"
},
"devDependencies": {
"@babel/core": "^7.24.7",
Expand Down
14 changes: 11 additions & 3 deletions vite.config.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
// vite.config.ts
import { defineConfig } from 'vite'
import react from '@vitejs/plugin-react'
import path from 'path'
import { defineConfig } from 'vite';
import { VitePWA } from 'vite-plugin-pwa';
import react from '@vitejs/plugin-react';
import path from 'path';

// https://vitejs.dev/config/
export default defineConfig({
Expand All @@ -25,5 +26,12 @@ export default defineConfig({
plugins: ['babel-plugin-macros', 'babel-plugin-styled-components'],
},
}),
VitePWA({
registerType: 'autoUpdate',
workbox: {
globPatterns: ['**/*.{js,css,html,ico,png,svg,pdf,json}'],
maximumFileSizeToCacheInBytes: 5000000, // 5mb
}
}),
],
})
Loading

0 comments on commit 4e1268d

Please sign in to comment.