-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Expand file tree
/
Copy pathrsbuild.config.ts
More file actions
85 lines (84 loc) · 2.18 KB
/
Copy pathrsbuild.config.ts
File metadata and controls
85 lines (84 loc) · 2.18 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
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
import path from 'node:path';
import { defineConfig } from '@rsbuild/core';
import { pluginLess } from '@rsbuild/plugin-less';
import { pluginNodePolyfill } from '@rsbuild/plugin-node-polyfill';
import { pluginReact } from '@rsbuild/plugin-react';
import { pluginSvgr } from '@rsbuild/plugin-svgr';
import { pluginTypeCheck } from '@rsbuild/plugin-type-check';
import { pluginWorkspaceDev } from 'rsbuild-plugin-workspace-dev';
import { version as playgroundVersion } from '../../packages/playground/package.json';
import {
commonIgnoreWarnings,
createCoreReportTemplateReplacementPlugin,
createPlaygroundCopyPlugin,
} from '../../scripts/rsbuild-utils.ts';
export default defineConfig({
tools: {
rspack: {
ignoreWarnings: commonIgnoreWarnings,
},
},
environments: {
web: {
source: {
entry: {
index: './src/index.tsx',
},
define: {
__APP_VERSION__: JSON.stringify(playgroundVersion),
},
},
output: {
target: 'web',
externals: ['sharp'],
sourceMap: true,
},
html: {
title: 'Midscene Computer Playground',
},
},
},
dev: {
writeToDisk: true,
},
resolve: {
alias: {
async_hooks: path.join(
__dirname,
'../../packages/shared/src/polyfills/async-hooks.ts',
),
'node:async_hooks': path.join(
__dirname,
'../../packages/shared/src/polyfills/async-hooks.ts',
),
react: path.resolve(__dirname, 'node_modules/react'),
'react-dom': path.resolve(__dirname, 'node_modules/react-dom'),
},
},
output: {
externals: ['sharp'],
},
plugins: [
pluginReact(),
pluginNodePolyfill(),
pluginLess(),
pluginSvgr(),
createCoreReportTemplateReplacementPlugin({
appDir: __dirname,
}),
createPlaygroundCopyPlugin(
path.join(__dirname, 'dist'),
path.join(__dirname, '../../packages/computer-playground/static'),
'copy-computer-playground-static',
path.join(__dirname, 'src', 'favicon.ico'),
),
pluginTypeCheck(),
pluginWorkspaceDev({
projects: {
'@midscene/report': {
skip: true,
},
},
}),
],
});