mirror of
https://github.com/whyour/qinglong.git
synced 2025-07-07 20:06: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,
|
changeOrigin: true,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
chainWebpack(memo) {
|
chainWebpack: (config) => {
|
||||||
memo.plugin('CompressionPlugin').use(
|
config.plugin('compression-webpack-plugin').use(
|
||||||
new CompressionPlugin({
|
new CompressionPlugin({
|
||||||
filename: '[path][base].gz',
|
|
||||||
algorithm: 'gzip',
|
algorithm: 'gzip',
|
||||||
test: /\.js$|\.css$|\.html$/,
|
test: new RegExp('\\.(js|css)$'),
|
||||||
threshold: 10240,
|
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_vary on;
|
||||||
gzip_comp_level 6;
|
gzip_comp_level 6;
|
||||||
gzip_buffers 16 8k;
|
gzip_buffers 16 8k;
|
||||||
gzip_http_version 1.1;
|
gzip_http_version 1.0;
|
||||||
|
|
||||||
location / {
|
location / {
|
||||||
index index.html index.htm;
|
index index.html index.htm;
|
||||||
|
|
|
@ -5,10 +5,10 @@ import config from './config';
|
||||||
const time = Date.now();
|
const time = Date.now();
|
||||||
const errorHandler = function (error: any) {
|
const errorHandler = function (error: any) {
|
||||||
if (error.response) {
|
if (error.response) {
|
||||||
const message = error.data
|
const message = error.data ? error.data.message : error.response.statusText;
|
||||||
? error.data.errors && error.data.errors.message
|
if (error.response.status !== 401) {
|
||||||
: error.response.statusText;
|
|
||||||
notification.error({ message });
|
notification.error({ message });
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
console.log(error.message);
|
console.log(error.message);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user