mirror of
https://github.com/tencentmusic/supersonic.git
synced 2025-12-10 19:51:00 +00:00
@@ -17,6 +17,10 @@ demo:
|
||||
|
||||
server:
|
||||
port: 9080
|
||||
compression:
|
||||
enabled: true
|
||||
min-response-size: 1024
|
||||
mime-types: application/javascript,application/json,application/xml,text/html,text/xml,text/plain,text/css,image/*
|
||||
|
||||
authentication:
|
||||
enable: true
|
||||
|
||||
@@ -6,6 +6,8 @@ import proxy from './proxy';
|
||||
import routes from './routes';
|
||||
import moment from 'moment';
|
||||
import ENV_CONFIG from './envConfig';
|
||||
import CompressionWebpackPlugin from 'compression-webpack-plugin'
|
||||
|
||||
|
||||
const { REACT_APP_ENV, RUN_TYPE } = process.env;
|
||||
|
||||
@@ -77,4 +79,17 @@ export default defineConfig({
|
||||
resolve: {
|
||||
includes: ['src/components'],
|
||||
},
|
||||
chainWebpack: (config) => {
|
||||
if (process.env.NODE_ENV === 'production') { // 生产模式开启
|
||||
config.plugin('compression-webpack-plugin').use(
|
||||
new CompressionWebpackPlugin({
|
||||
algorithm: 'gzip',
|
||||
test: new RegExp('\\.(' + ['js', 'css'].join('|') + ')$'),
|
||||
threshold: 10240,
|
||||
minRatio: 0.6,
|
||||
deleteOriginalAssets: false, // 不删除源文件
|
||||
})
|
||||
);
|
||||
}
|
||||
},
|
||||
});
|
||||
|
||||
@@ -73,6 +73,7 @@
|
||||
"ahooks": "^3.7.7",
|
||||
"antd": "^5.11.0",
|
||||
"classnames": "^2.2.6",
|
||||
"compression-webpack-plugin": "^11.0.0",
|
||||
"copy-to-clipboard": "^3.3.1",
|
||||
"cross-env": "^7.0.3",
|
||||
"crypto-js": "^4.0.0",
|
||||
|
||||
Reference in New Issue
Block a user