|
@@ -72,4 +72,51 @@ module.exports = {
|
|
|
devtool: "source-map",
|
|
|
plugins: [new webpack.IgnorePlugin(/^\.\/locale$/, /moment|iview$/)],
|
|
|
},
|
|
|
+ pwa: {
|
|
|
+ workboxPluginMode: "GenerateSW",
|
|
|
+ workboxOptions: {
|
|
|
+ importWorkboxFrom: "local",
|
|
|
+ navigateFallback: "index.html",
|
|
|
+ skipWaiting: true,
|
|
|
+ clientsClaim: true,
|
|
|
+ runtimeCaching: [
|
|
|
+ {
|
|
|
+ // Match any same-origin request that contains 'api'.
|
|
|
+ urlPattern: new RegExp(
|
|
|
+ "^https://cdn.qmth.com.cn/ui/ecs-client-bg.jpg!/progressive/true"
|
|
|
+ ),
|
|
|
+ // Apply a network-first strategy.
|
|
|
+ handler: "staleWhileRevalidate",
|
|
|
+ options: {
|
|
|
+ cacheableResponse: {
|
|
|
+ statuses: [0, 200],
|
|
|
+ },
|
|
|
+ },
|
|
|
+ },
|
|
|
+ {
|
|
|
+ // Match any same-origin request that contains 'api'.
|
|
|
+ urlPattern: /\/api\/ecs_core\/org\/propertyNoSession\/OE_STUDENT_SYS_NAME\?domainName=/,
|
|
|
+ // Apply a network-first strategy.
|
|
|
+ handler: "staleWhileRevalidate",
|
|
|
+ },
|
|
|
+ {
|
|
|
+ // Match any same-origin request that contains 'api'.
|
|
|
+ urlPattern: /\/api\/ecs_core\/org\/logo\?domain=/,
|
|
|
+ // Apply a network-first strategy.
|
|
|
+ handler: "staleWhileRevalidate",
|
|
|
+ },
|
|
|
+ {
|
|
|
+ // Match any same-origin request that contains 'api'.
|
|
|
+ urlPattern: /\/models\/.*\.json/,
|
|
|
+ // Apply a network-first strategy.
|
|
|
+ handler: "cacheFirst",
|
|
|
+ options: {
|
|
|
+ cacheableResponse: {
|
|
|
+ statuses: [0, 200],
|
|
|
+ },
|
|
|
+ },
|
|
|
+ },
|
|
|
+ ],
|
|
|
+ },
|
|
|
+ },
|
|
|
};
|