ui: add service worker to cache resources (#445)

This commit is contained in:
undefined authored and GitHub committed 2022-10-20 01:34:30 +08:00
1 parent aa5df5346a
commit fcc4eedd9f
10 files changed
+112 -54

No files matched your search

+5 -3
View File
@@ -9,6 +9,7 @@ import MonacoWebpackPlugin from 'monaco-editor-webpack-plugin';
import { dirname } from 'path';
import webpack from 'webpack';
import { BundleAnalyzerPlugin } from 'webpack-bundle-analyzer';
import { WebpackManifestPlugin } from 'webpack-manifest-plugin';
import WebpackBar from 'webpackbar';
import root from '../utils/root';
@@ -18,7 +19,7 @@ export default function (env: { watch?: boolean, production?: boolean, measure?:
loader: 'esbuild-loader',
options: {
loader: 'tsx',
target: 'es2015',
target: 'chrome80',
sourcemap: true,
},
};
@@ -220,7 +221,7 @@ export default function (env: { watch?: boolean, production?: boolean, measure?:
minifyIdentifiers: true,
treeShaking: true,
target: [
'chrome60',
'chrome80',
],
exclude: [/mathmaps/, /\.min\.js$/],
})],
@@ -240,8 +241,9 @@ export default function (env: { watch?: boolean, production?: boolean, measure?:
new ExtractCssPlugin({
filename: '[name].css?[fullhash:6]',
}),
new WebpackManifestPlugin({}),
new FriendlyErrorsPlugin(),
new webpack.IgnorePlugin({ resourceRegExp: /(^\.\/locale$|mathjax|abcjs)/ }),
new webpack.IgnorePlugin({ resourceRegExp: /(^\.\/locale$|mathjax|abcjs|vditor.+\.d\.ts)/ }),
new CopyWebpackPlugin({
patterns: [
{ from: root('static') },