mirror of
https://github.com/whyour/qinglong.git
synced 2025-07-07 11:56:08 +08:00
修复upstream gzip压缩,前端公共依赖采用cdn
This commit is contained in:
parent
f0be863b3f
commit
9f54a15ab8
21
.umirc.ts
21
.umirc.ts
|
@ -15,15 +15,26 @@ export default defineConfig({
|
|||
changeOrigin: true,
|
||||
},
|
||||
},
|
||||
chainWebpack(memo) {
|
||||
memo.plugin('CompressionPlugin').use(
|
||||
chainWebpack: (config) => {
|
||||
config.plugin('compression-webpack-plugin').use(
|
||||
new CompressionPlugin({
|
||||
filename: '[path][base].gz',
|
||||
algorithm: 'gzip',
|
||||
test: /\.js$|\.css$|\.html$/,
|
||||
test: new RegExp('\\.(js|css)$'),
|
||||
threshold: 10240,
|
||||
minRatio: 0.8,
|
||||
minRatio: 0.6,
|
||||
}),
|
||||
);
|
||||
},
|
||||
externals: {
|
||||
react: 'window.React',
|
||||
'react-dom': 'window.ReactDOM',
|
||||
codemirror: 'window.CodeMirror',
|
||||
darkreader: 'window.DarkReader',
|
||||
},
|
||||
scripts: [
|
||||
'https://gw.alipayobjects.com/os/lib/react/16.13.1/umd/react.production.min.js',
|
||||
'https://gw.alipayobjects.com/os/lib/react-dom/16.13.1/umd/react-dom.production.min.js',
|
||||
'https://cdn.jsdelivr.net/npm/codemirror@5.60.0/lib/codemirror.min.js',
|
||||
'https://cdn.jsdelivr.net/npm/darkreader@4.9.27/darkreader.min.js',
|
||||
],
|
||||
});
|
||||
|
|
|
@ -18,7 +18,7 @@ server {
|
|||
gzip_vary on;
|
||||
gzip_comp_level 6;
|
||||
gzip_buffers 16 8k;
|
||||
gzip_http_version 1.1;
|
||||
gzip_http_version 1.0;
|
||||
|
||||
location / {
|
||||
index index.html index.htm;
|
||||
|
|
|
@ -5,10 +5,10 @@ import config from './config';
|
|||
const time = Date.now();
|
||||
const errorHandler = function (error: any) {
|
||||
if (error.response) {
|
||||
const message = error.data
|
||||
? error.data.errors && error.data.errors.message
|
||||
: error.response.statusText;
|
||||
const message = error.data ? error.data.message : error.response.statusText;
|
||||
if (error.response.status !== 401) {
|
||||
notification.error({ message });
|
||||
}
|
||||
} else {
|
||||
console.log(error.message);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user