-
Notifications
You must be signed in to change notification settings - Fork 13
Expand file tree
/
Copy pathrsbuild.config.ts
More file actions
65 lines (55 loc) · 1.66 KB
/
rsbuild.config.ts
File metadata and controls
65 lines (55 loc) · 1.66 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
// rsbuild.config.ts
import path from 'node:path';
import { defineConfig } from '@rsbuild/core';
import { pluginReact } from '@rsbuild/plugin-react';
import { pluginSass } from '@rsbuild/plugin-sass';
const resolvePath = (p: string) => path.resolve(__dirname, p);
export default defineConfig({
plugins: [pluginReact(), pluginSass()],
source: {
// If your entry is different (e.g. src/main.tsx) adjust here.
entry: {
index: resolvePath('./src/main.tsx'),
},
},
resolve: {
alias: {
'@': resolvePath('./src'),
'@shared': resolvePath('./src/shared'),
'@pages': resolvePath('./src/pages'),
},
},
html: {
title: 'Recipes Explorer',
},
output: {
// Optional, but makes builds predictable
distPath: {
root: resolvePath('./dist'),
},
cleanDistPath: true,
},
server: {
port: 3000,
// Important for React Router v5 in SPA mode:
// ensures direct navigation to /recipes/123 works in dev.
historyApiFallback: true,
open: false,
},
tools: {
// Rsbuild will also load postcss.config.* automatically if present.
// This hook lets you enforce/extend plugins without relying on external config.
postcss: (opts) => {
opts.postcssOptions ??= {};
opts.postcssOptions.plugins ??= [];
// Example (uncomment if you have these deps):
// opts.postcssOptions.plugins.push(require('autoprefixer'));
// opts.postcssOptions.plugins.push(require('postcss-nested'));
},
// Optional: small Rspack tweaks if needed later.
// Prefer "tools.bundlerChain" for advanced changes.
rspack: {
// Example: add defines, fallbacks, etc.
},
},
});