-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathrsbuild.config.ts
More file actions
66 lines (63 loc) · 1.43 KB
/
rsbuild.config.ts
File metadata and controls
66 lines (63 loc) · 1.43 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
import { defineConfig } from '@rsbuild/core';
import { pluginReact } from '@rsbuild/plugin-react';
import { pluginSass } from '@rsbuild/plugin-sass';
import path from 'path';
let ENV_url;
try {
const {ENV_url: importedUrl} = require('./url.config');
ENV_url = importedUrl;
} catch (error) {
console.error('没有url.config.js文件:', error);
ENV_url = '';
}
export default defineConfig({
source: {
entry: {
index: './src/main.tsx'
},
},
resolve: {
alias: {
'@': path.resolve(__dirname, './')
}
},
plugins: [pluginReact(), pluginSass()],
server: {
proxy: {
'/api': {
target: ENV_url,
changeOrigin: true,
}
}
},
output: {
module: true,
legalComments: 'none',
distPath: {
root: 'dist',
js: '',
jsAsync: '',
css: '',
cssAsync: '',
image: '',
font: '',
svg: '',
favicon: '',
assets: '',
},
inlineScripts({size}) {
return size < 10 * 1000;
},
},
performance: {
chunkSplit: {
// 代码拆分
strategy: 'split-by-size',
minSize: 30000, // 30k
maxSize: 500000, // 50k
},
printFileSize: {
diff: true,
},
},
});