client: add sw

pull/44/head
fantasticit 2022-05-18 16:50:42 +08:00
parent e8bdb8fb7c
commit bed61365cd
3 changed files with 2008 additions and 78 deletions

View File

@ -1,6 +1,6 @@
/* eslint-env es6 */
const semi = require('@douyinfe/semi-next').default({});
const TsconfigPathsPlugin = require('tsconfig-paths-webpack-plugin');
const withOffline = require('next-offline');
const { getConfig } = require('@think/config');
const config = getConfig();
@ -24,6 +24,26 @@ const nextConfig = semi({
typescript: {
ignoreBuildErrors: true,
},
workboxOpts: {
runtimeCaching: [
{
urlPattern: /.(png|jpg|jpeg|svg|webp)$/,
handler: 'CacheFirst',
},
{
urlPattern: /api/,
handler: 'NetworkFirst',
options: {
cacheableResponse: {
statuses: [0, 200],
headers: {
'x-sw': 'true',
},
},
},
},
],
},
});
module.exports = nextConfig;
module.exports = withOffline(nextConfig);

View File

@ -70,6 +70,7 @@
"markdown-it-sub": "^1.0.0",
"markdown-it-sup": "^1.0.0",
"next": "12.0.10",
"next-offline": "^5.0.5",
"prosemirror-markdown": "^1.7.0",
"prosemirror-tables": "^1.1.1",
"prosemirror-utils": "^0.9.6",

File diff suppressed because it is too large Load Diff