diff --git a/bun.lockb b/bun.lockb
index 8ec99f3..80c565c 100755
Binary files a/bun.lockb and b/bun.lockb differ
diff --git a/env.d.ts b/env.d.ts
index 332f8d5..fb315d8 100644
--- a/env.d.ts
+++ b/env.d.ts
@@ -1,4 +1,5 @@
///
+///
///
///
///
diff --git a/index.html b/index.html
index 277cb7d..c584e39 100644
--- a/index.html
+++ b/index.html
@@ -2,11 +2,15 @@
+
+
+
+
+
+
-
-
AS Web
diff --git a/package.json b/package.json
index bdf74f7..f0e49d8 100644
--- a/package.json
+++ b/package.json
@@ -58,6 +58,7 @@
"unplugin-vue-components": "^0.27.0",
"vite": "^5.2.13",
"vite-plugin-comlink": "^5.0.1",
+ "vite-plugin-pwa": "^0.20.0",
"vite-svg-loader": "^5.1.0",
"vue-tsc": "^2.0.21"
}
diff --git a/public/manifest.json b/public/manifest.json
deleted file mode 100644
index 6730545..0000000
--- a/public/manifest.json
+++ /dev/null
@@ -1,16 +0,0 @@
-{
- "icons": [
- {
- "sizes": "192x192",
- "src": "/android-chrome-192x192.png",
- "type": "image/png"
- },
- {
- "sizes": "512x512",
- "src": "/android-chrome-512x512.png",
- "type": "image/png"
- }
- ],
- "name": "AS Web",
- "short_name": "AS Web"
-}
diff --git a/src/main.ts b/src/main.ts
index 9fdc378..b138e10 100644
--- a/src/main.ts
+++ b/src/main.ts
@@ -1,3 +1,4 @@
+import './setup/serviceWorker';
// eslint-disable-next-line import/order
import { VxeTableModules } from './setup/vxeTable';
import 'splitpanes/dist/splitpanes.css';
diff --git a/src/setup/serviceWorker.ts b/src/setup/serviceWorker.ts
new file mode 100644
index 0000000..dca8b0b
--- /dev/null
+++ b/src/setup/serviceWorker.ts
@@ -0,0 +1,3 @@
+import { registerSW } from 'virtual:pwa-register';
+
+registerSW({ immediate: true });
diff --git a/vite.config.ts b/vite.config.ts
index 276eacc..171790f 100644
--- a/vite.config.ts
+++ b/vite.config.ts
@@ -9,13 +9,42 @@ import { ElementPlusResolver } from 'unplugin-vue-components/resolvers';
import Components from 'unplugin-vue-components/vite';
import { defineConfig } from 'vite';
import { comlink } from 'vite-plugin-comlink';
+import { VitePWA } from 'vite-plugin-pwa';
import SvgLoader from 'vite-svg-loader';
const pathSrc = resolve(__dirname, 'src');
// https://vitejs.dev/config/
export default defineConfig(({ command }) => ({
+ build: {
+ sourcemap: true,
+ },
plugins: [
+ VitePWA({
+ registerType: 'autoUpdate',
+ workbox: {
+ maximumFileSizeToCacheInBytes: 4e6,
+ },
+ manifest: {
+ name: 'AS Web',
+ short_name: 'AS Web',
+ background_color: '#f4f4f5',
+ theme_color: '#f4f4f5',
+ display: 'standalone',
+ icons: [
+ {
+ sizes: '192x192',
+ src: '/android-chrome-192x192.png',
+ type: 'image/png',
+ },
+ {
+ sizes: '512x512',
+ src: '/android-chrome-512x512.png',
+ type: 'image/png',
+ },
+ ],
+ },
+ }),
comlink(),
Vue(),
SvgLoader(),