-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathrsbuild.config.ts
59 lines (55 loc) · 2.05 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
import path from 'node:path'
import { defineConfig, type RsbuildConfig } from '@rsbuild/core'
import { pluginBabel } from '@rsbuild/plugin-babel'
import { pluginSolid } from '@rsbuild/plugin-solid'
import { pluginTypeCheck } from '@rsbuild/plugin-type-check'
import { UnoCSSRspackPlugin } from '@unocss/webpack/rspack'
import { createGenerator } from 'unocss'
import unoConfig from './uno.config'
const host = process.env.TAURI_DEV_HOST
const unoCtx = createGenerator(unoConfig)
export default defineConfig(
async ({ env, command }) =>
({
html: {
template: './index.html',
},
source: {
entry: {
index: './src/index.tsx',
},
define: {
// https://github.com/unocss/unocss/discussions/1908#discussioncomment-4371270
'import.meta.env.__UNO__': JSON.stringify(await unoCtx),
'import.meta.env.__UNO_THEME__': JSON.stringify((await unoCtx).config.theme),
},
},
plugins: [pluginBabel({ include: /\.(?:jsx|tsx)$/, exclude: /[\\/]node_modules[\\/]/ }), pluginSolid(), pluginTypeCheck()],
server: {
port: 1420,
strictPort: true,
host: host,
},
dev: {
// hmr: !!host,
// client: { protocol: 'ws', host: 'localhost', port: 1421 },
watchFiles: {
paths: ['uno.config.ts'],
type: 'reload-server',
},
},
tools: {
rspack: {
watchOptions: {
ignored: ['**/src-tauri/**'],
},
plugins: [UnoCSSRspackPlugin({})],
},
},
resolve: {
alias: {
'~': path.resolve(__dirname, './src'),
},
},
}) as RsbuildConfig,
)