Repository navigation
Expand file tree
/
Copy pathvite.config.mjs
More file actions
60 lines (59 loc) · 2.57 KB
/
Copy pathvite.config.mjs
File metadata and controls
60 lines (59 loc) · 2.57 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
// @ts-check
// Vite 8 (rolldown) config. The app runs inside Harper via @harperfast/vite:
// `harper dev .` serves this with HMR on Harper's own port, and `harper run .`
// builds it (client + SSR bundles) and renders HTML per navigation — see
// config.yaml. No dev proxy needed: the API, OAuth, and the frontend share
// one origin.
import { defineConfig, defaultClientConditions, defaultServerConditions } from 'vite';
import react from '@vitejs/plugin-react';
import { uiComponentsResolver } from './config/ui-components-resolver.mjs';
import { setupCommandsPlugin } from './config/setup-commands.mjs';
export default defineConfig({
plugins: [react(), uiComponentsResolver, setupCommandsPlugin()],
resolve: {
// 'rolldown' steers @node-core/ui-components' `#ui/*` imports map to
// compiled dist/ output instead of raw TSX source.
conditions: [...defaultClientConditions, 'rolldown'],
},
ssr: {
// 'harper' must resolve to the running Harper runtime, never be
// bundled — node_modules/harper is a symlink to the host install and
// symlinked deps are not reliably auto-externalized for SSR.
external: ['harper'],
noExternal: ['@node-core/ui-components'],
resolve: {
conditions: [...defaultServerConditions, 'rolldown'],
},
},
build: {
outDir: 'dist',
// One stylesheet for the whole app, linked from the document head. The
// SSR'd markup uses the design system's hashed CSS-module classes, so
// every page must have all component styles before its JS chunk
// arrives; per-chunk CSS would leave server-rendered markup unstyled
// until hydration. JS stays code-split — this only merges CSS.
cssCodeSplit: false,
},
optimizeDeps: {
// Prebundle the design-system components (and, through them, Radix,
// heroicons, and classnames) so dev serves a handful of dep chunks
// instead of the package's raw per-file modules.
include: [
'@node-core/ui-components/Common/AlertBox',
'@node-core/ui-components/Common/Badge',
'@node-core/ui-components/Common/BaseButton',
'@node-core/ui-components/Common/BaseCodeBox',
'@node-core/ui-components/Common/CodeTabs',
'@node-core/ui-components/Common/GlowingBackdrop',
'@node-core/ui-components/Common/NodejsLogo',
'@node-core/ui-components/Common/Select',
'@node-core/ui-components/Common/Skeleton',
'@node-core/ui-components/Common/Switch',
'@node-core/ui-components/Common/Tabs',
'@node-core/ui-components/Common/ThemeToggle',
'@node-core/ui-components/Containers/Footer',
'@node-core/ui-components/Containers/NavBar',
'@node-core/ui-components/Icons/Social/GitHub',
],
},
});