diff --git a/site/bisheng.config.js b/site/bisheng.config.js index 98f7a91c25..e356c0ea12 100644 --- a/site/bisheng.config.js +++ b/site/bisheng.config.js @@ -1,10 +1,8 @@ const path = require('path'); const CSSSplitWebpackPlugin = require('css-split-webpack-plugin').default; -const OfflinePlugin = require('@yesmeck/offline-plugin'); const replaceLib = require('antd-tools/lib/replaceLib'); const webpack = require('webpack'); const WebpackBar = require('webpackbar'); -const getExternalResources = require('./getExternalResources'); const isDev = process.env.NODE_ENV === 'development'; const usePreact = process.env.REACT_ENV === 'preact'; @@ -132,26 +130,6 @@ module.exports = { config.plugins.push( new CSSSplitWebpackPlugin({ size: 4000 }), - new OfflinePlugin({ - appShell: '/app-shell', - caches: { - main: [':rest:'], - additional: [':externals:'], - }, - externals: [ - '/app-shell', - 'https://at.alicdn.com/t/font_148784_v4ggb6wrjmkotj4i.woff', - 'https://at.alicdn.com/t/font_148784_v4ggb6wrjmkotj4i.eot', - 'https://at.alicdn.com/t/font_148784_v4ggb6wrjmkotj4i.svg', - 'https://at.alicdn.com/t/font_148784_v4ggb6wrjmkotj4i.ttf', - ].concat(getExternalResources()), - responseStrategy: 'network-first', - safeToUseOptionalCaches: true, - ServiceWorker: { - events: true, - }, - AppCache: false, - }), ); return config; diff --git a/site/getExternalResources.js b/site/getExternalResources.js deleted file mode 100644 index 8e2d204932..0000000000 --- a/site/getExternalResources.js +++ /dev/null @@ -1,19 +0,0 @@ -const glob = require('glob'); -const fs = require('fs'); -const { uniq } = require('lodash'); - -function getExternalResources() { - const files = glob.sync('{./{components,docs}/**/*.md,./site/**/*.{less,js,jsx}}'); - const resources = files.reduce((acc, file) => { - const content = fs.readFileSync(file, 'utf-8'); - const pattern = new RegExp('(https://.+\\.alipayobjects\\.com/.+\\.(png|jpg|svg)|)', 'mg'); - const matches = content.match(pattern); - if (matches) { - acc = acc.concat(matches); - } - return acc; - }, []); - return uniq(resources); -} - -module.exports = getExternalResources;