-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathrsbuild.config.ts
76 lines (72 loc) · 1.87 KB
/
rsbuild.config.ts
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
67
68
69
70
71
72
73
74
75
76
import { defineConfig } from '@rsbuild/core';
import { pluginVue2 } from '@rsbuild/plugin-vue2';
import { pluginSass } from '@rsbuild/plugin-sass';
import { pluginCheckSyntax } from '@rsbuild/plugin-check-syntax';
import { RsdoctorRspackPlugin } from '@rsdoctor/rspack-plugin';
const isDev = process.env.NODE_ENV === 'development';
const entry = {
'test-page': './src/pages/test-page/entry.js',
};
// ['record-portrait', 'record-replay', 'record-aigc'].forEach(chapterType => {
// entry[chapterType] = `./src/pages/${chapterType}/main.js`;
// });
export default defineConfig({
plugins: [
pluginVue2(),
pluginSass(),
// pluginLess(),
pluginCheckSyntax({
ecmaVersion: 5,
}),
],
tools: {
rspack: {
plugins: [
// 仅在 RSDOCTOR 为 true 时注册插件,因为插件会增加构建耗时
process.env.RSDOCTOR && new RsdoctorRspackPlugin(),
].filter(Boolean),
// output: {
// asyncChunks: false,
// },
},
// lightningcssLoader: false,
},
source: {
entry,
include: [
/node_modules[\\/]pinia[\\/]/,
/node_modules[\\/]uuid[\\/]/,
/node_modules[\\/]@vue[\\/]devtools-api[\\/]/,
],
decorators: { version: 'legacy' }
// alias: {
// '@': './src',
// },
},
html: {
mountId: 'app',
template: './public/index.html',
},
output: {
polyfill: 'entry',
dataUriLimit: 102400,
legalComments: 'none',
sourceMap: {
js: isDev
? // 开发模式使用性能更好的 source map 格式
'cheap-module-source-map'
: // 生产模式使用高质量的 source map 格式
'source-map',
},
// filenameHash: false,
// distPath: {
// js: '',
// },
// injectStyles: true,
},
// performance: {
// chunkSplit: {
// strategy: isDev ? 'split-by-experience' : 'all-in-one',
// },
// },
});