PWA
This commit is contained in:
1 parent
999723508a
commit
18151fda81
7 files changed
+4958
-2
No files matched your search
@@ -4,6 +4,7 @@ import vue from '@vitejs/plugin-vue'
|
||||
import AutoImport from 'unplugin-auto-import/vite'
|
||||
import Components from 'unplugin-vue-components/vite'
|
||||
import { ElementPlusResolver } from 'unplugin-vue-components/resolvers'
|
||||
import { VitePWA } from 'vite-plugin-pwa'
|
||||
|
||||
const versions = readFileSync(new URL('../versions.props', import.meta.url), 'utf8')
|
||||
const frontendVersion = /<JiaowuFrontendVersion>([^<]+)<\/JiaowuFrontendVersion>/.exec(versions)?.[1]
|
||||
@@ -31,6 +32,44 @@ export default defineConfig(({ mode }) => {
|
||||
resolvers: [ElementPlusResolver({ importStyle: 'css', directives: true })],
|
||||
dts: 'src/components.d.ts',
|
||||
}),
|
||||
VitePWA({
|
||||
disable: isCapacitor,
|
||||
registerType: 'prompt',
|
||||
// Registration is handled in src/services/pwa.ts so updates can be
|
||||
// confirmed before the active session is reloaded.
|
||||
injectRegister: false,
|
||||
includeAssets: ['favicon.svg'],
|
||||
manifest: {
|
||||
name: '明序大学教务管理系统',
|
||||
short_name: '明序教务',
|
||||
description: '明序大学教务管理系统',
|
||||
theme_color: '#152550',
|
||||
background_color: '#152550',
|
||||
display: 'standalone',
|
||||
start_url: '/',
|
||||
scope: '/',
|
||||
lang: 'zh-CN',
|
||||
icons: [
|
||||
{
|
||||
src: 'favicon.svg',
|
||||
sizes: 'any',
|
||||
type: 'image/svg+xml',
|
||||
purpose: 'any maskable',
|
||||
},
|
||||
],
|
||||
},
|
||||
workbox: {
|
||||
cleanupOutdatedCaches: true,
|
||||
navigateFallback: '/index.html',
|
||||
navigateFallbackDenylist: [/^\/api\//],
|
||||
runtimeCaching: [
|
||||
{
|
||||
urlPattern: /\/api\/.*/,
|
||||
handler: 'NetworkOnly',
|
||||
},
|
||||
],
|
||||
},
|
||||
}),
|
||||
],
|
||||
base: isCapacitor ? './' : '/',
|
||||
build: {
|
||||
|
||||
Reference in new issue
Block a user