-
Notifications
You must be signed in to change notification settings - Fork 8
Expand file tree
/
Copy pathrsbuild.config.ts
More file actions
67 lines (66 loc) · 1.74 KB
/
rsbuild.config.ts
File metadata and controls
67 lines (66 loc) · 1.74 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
67
import { defineConfig } from '@rsbuild/core';
import { pluginReact } from '@rsbuild/plugin-react';
import { pluginSass } from '@rsbuild/plugin-sass';
import { pluginTypeCheck } from '@rsbuild/plugin-type-check';
export default defineConfig({
source: {
entry: {
entry: ['./js/entry.ts'],
main: ['./js/main.ts', './css/main.scss'],
history: ['./js/history.ts', './css/history.css'],
manage: ['./js/manage.ts'],
report: ['./js/treemap.ts'],
api: ['./js/api.tsx'],
projects: ['./js/projects.ts'],
},
},
output: {
// Write manifest.json, we pull JS and CSS asset paths from it
manifest: true,
// Copy public files to dist
copy: [{ from: 'public' }],
},
tools: {
// Disable HTML generation
htmlPlugin: false,
rspack: {
// Use shared runtime for all entry points
optimization: {
runtimeChunk: 'single',
},
// Disable bundler info to save a few bytes
experiments: {
rspackFuture: {
bundlerInfo: {
force: false,
},
},
},
},
},
plugins: [pluginSass(), pluginTypeCheck(), pluginReact()],
server: {
port: 3001,
headers: {
'Cross-Origin-Resource-Policy': 'cross-origin',
},
},
dev: {
// Load assets directly from dev server
assetPrefix: 'http://localhost:<port>/',
// Connect HMR directly to dev server
client: {
host: 'localhost',
port: '<port>',
// Error overlay doesn't work with CSP
overlay: false,
},
// Always write dist/manifest.json and public files
writeToDisk: (file) => {
return (
file.endsWith('manifest.json') ||
(!file.includes('static/') && !file.includes('hot-update'))
);
},
},
});