|
|
@ -13,17 +13,15 @@ const buildDatePlugin = () => {
|
|
|
|
};
|
|
|
|
};
|
|
|
|
};
|
|
|
|
};
|
|
|
|
// PWA plugin
|
|
|
|
// PWA plugin
|
|
|
|
const manifestForPlugIn = {
|
|
|
|
const manifestForPWAPlugIn = {
|
|
|
|
// strategies: 'generateSW',
|
|
|
|
// strategies: 'generateSW',
|
|
|
|
registerType: 'prompt',
|
|
|
|
registerType: 'prompt',
|
|
|
|
// includeAssests: ['/src/assets/logo-gh.png'],
|
|
|
|
devOptions: { enabled: true },
|
|
|
|
// registerType: 'autoUpdate',
|
|
|
|
|
|
|
|
devOptions: {
|
|
|
|
|
|
|
|
enabled: true
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
workbox: {
|
|
|
|
workbox: {
|
|
|
|
|
|
|
|
// dontCacheBustURLsMatching: /\/maintenance/,
|
|
|
|
navigateFallbackDenylist: [/^\/maintenance/],
|
|
|
|
navigateFallbackDenylist: [/^\/maintenance/],
|
|
|
|
globPatterns: ['**/*.{json,css,js,html,ico,png,svg,woff2}'],
|
|
|
|
globPatterns: ['**/*.{json,css,js,html,ico,png,svg,woff2}'],
|
|
|
|
|
|
|
|
globIgnores: ['**/maintenance.html', '**/maintenance/*'],
|
|
|
|
maximumFileSizeToCacheInBytes: 3000000,
|
|
|
|
maximumFileSizeToCacheInBytes: 3000000,
|
|
|
|
clientsClaim: true,
|
|
|
|
clientsClaim: true,
|
|
|
|
// skipWaiting: true,
|
|
|
|
// skipWaiting: true,
|
|
|
@ -35,12 +33,12 @@ const manifestForPlugIn = {
|
|
|
|
cacheName: 'oss-cn-media',
|
|
|
|
cacheName: 'oss-cn-media',
|
|
|
|
expiration: {
|
|
|
|
expiration: {
|
|
|
|
maxEntries: 20,
|
|
|
|
maxEntries: 20,
|
|
|
|
maxAgeSeconds: 60 * 60 * 24 * 7 // <== 7 days
|
|
|
|
maxAgeSeconds: 60 * 60 * 24 * 7, // <== 7 days
|
|
|
|
},
|
|
|
|
},
|
|
|
|
cacheableResponse: {
|
|
|
|
cacheableResponse: {
|
|
|
|
statuses: [0, 200]
|
|
|
|
statuses: [0, 200],
|
|
|
|
}
|
|
|
|
},
|
|
|
|
}
|
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
{
|
|
|
|
{
|
|
|
|
urlPattern: /^https:\/\/hiana-crm\.oss-ap-southeast-1\.aliyuncs\.com\/.*/i,
|
|
|
|
urlPattern: /^https:\/\/hiana-crm\.oss-ap-southeast-1\.aliyuncs\.com\/.*/i,
|
|
|
@ -49,12 +47,12 @@ const manifestForPlugIn = {
|
|
|
|
cacheName: 'oss-ap-media',
|
|
|
|
cacheName: 'oss-ap-media',
|
|
|
|
expiration: {
|
|
|
|
expiration: {
|
|
|
|
maxEntries: 20,
|
|
|
|
maxEntries: 20,
|
|
|
|
maxAgeSeconds: 60 * 60 * 24 * 7 // <== 7 days
|
|
|
|
maxAgeSeconds: 60 * 60 * 24 * 7, // <== 7 days
|
|
|
|
},
|
|
|
|
},
|
|
|
|
cacheableResponse: {
|
|
|
|
cacheableResponse: {
|
|
|
|
statuses: [0, 200]
|
|
|
|
statuses: [0, 200],
|
|
|
|
}
|
|
|
|
},
|
|
|
|
}
|
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
{
|
|
|
|
{
|
|
|
|
urlPattern: /^https:\/\/static-legacy\.dingtalk.com\/.*/i,
|
|
|
|
urlPattern: /^https:\/\/static-legacy\.dingtalk.com\/.*/i,
|
|
|
@ -63,12 +61,12 @@ const manifestForPlugIn = {
|
|
|
|
cacheName: 'dingtalk-avatar-media',
|
|
|
|
cacheName: 'dingtalk-avatar-media',
|
|
|
|
expiration: {
|
|
|
|
expiration: {
|
|
|
|
maxEntries: 50,
|
|
|
|
maxEntries: 50,
|
|
|
|
maxAgeSeconds: 60 * 60 * 24 * 7 // <== 7 days
|
|
|
|
maxAgeSeconds: 60 * 60 * 24 * 7, // <== 7 days
|
|
|
|
},
|
|
|
|
},
|
|
|
|
cacheableResponse: {
|
|
|
|
cacheableResponse: {
|
|
|
|
statuses: [0, 200]
|
|
|
|
statuses: [0, 200],
|
|
|
|
}
|
|
|
|
},
|
|
|
|
}
|
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
],
|
|
|
|
],
|
|
|
|
},
|
|
|
|
},
|
|
|
@ -112,7 +110,7 @@ export default defineConfig({
|
|
|
|
__BUILD_DATE__: JSON.stringify(`${new Date().toISOString()}`),
|
|
|
|
__BUILD_DATE__: JSON.stringify(`${new Date().toISOString()}`),
|
|
|
|
__BUILD_VERSION__: JSON.stringify(`${packageJson.version}`),
|
|
|
|
__BUILD_VERSION__: JSON.stringify(`${packageJson.version}`),
|
|
|
|
},
|
|
|
|
},
|
|
|
|
plugins: [react(), WindiCSS(), buildDatePlugin(), VitePWA(manifestForPlugIn)],
|
|
|
|
plugins: [react(), WindiCSS(), buildDatePlugin(), VitePWA(manifestForPWAPlugIn)],
|
|
|
|
server: {
|
|
|
|
server: {
|
|
|
|
host: '0.0.0.0',
|
|
|
|
host: '0.0.0.0',
|
|
|
|
},
|
|
|
|
},
|
|
|
@ -133,6 +131,7 @@ export default defineConfig({
|
|
|
|
maintenance: './maintenance.html'
|
|
|
|
maintenance: './maintenance.html'
|
|
|
|
},
|
|
|
|
},
|
|
|
|
output: {
|
|
|
|
output: {
|
|
|
|
|
|
|
|
entryFileNames: '[name]/build.[hash].js',
|
|
|
|
// manualChunks(id) {
|
|
|
|
// manualChunks(id) {
|
|
|
|
// if (id.includes('node_modules')) {
|
|
|
|
// if (id.includes('node_modules')) {
|
|
|
|
// return id.toString().split('node_modules/')[1].split('/')[0].toString();
|
|
|
|
// return id.toString().split('node_modules/')[1].split('/')[0].toString();
|
|
|
|