-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathvite.config.ts
More file actions
59 lines (58 loc) · 2.12 KB
/
Copy pathvite.config.ts
File metadata and controls
59 lines (58 loc) · 2.12 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
import { defineConfig } from 'vite-plus'
import react, { reactCompilerPreset } from '@vitejs/plugin-react'
import babel from '@rolldown/plugin-babel'
import tailwindcss from '@tailwindcss/vite'
import path from 'node:path'
export default defineConfig({
// Oxfmt — Prettier-compatible. Settings match the existing codebase style
// (single-quoted JS, no semicolons; JSX keeps double quotes by default).
fmt: {
ignorePatterns: ['dist/**'],
singleQuote: true,
semi: false,
},
// Oxlint — type-aware, replaces ESLint. The vite-plus JS plugin enforces
// importing from `vite-plus`; the react rules preserve the react-hooks
// coverage previously provided by eslint-plugin-react-hooks.
lint: {
ignorePatterns: ['dist/**'],
plugins: ['react', 'typescript', 'unicorn', 'oxc', 'import'],
jsPlugins: [{ name: 'vite-plus', specifier: 'vite-plus/oxlint-plugin' }],
rules: {
'vite-plus/prefer-vite-plus-imports': 'error',
'react/rules-of-hooks': 'error',
'react/exhaustive-deps': 'warn',
},
options: {
typeAware: true,
typeCheck: true,
},
},
plugins: [react(), babel({ presets: [reactCompilerPreset()] }), tailwindcss()],
resolve: {
alias: {
'@': path.resolve(__dirname, './src'),
},
},
build: {
rollupOptions: {
output: {
// Recharts + ses dépendances CommonJS (es-toolkit, d3, victory-vendor…) DOIVENT
// rester dans un SEUL chunk. Sinon Rolldown duplique des modules CJS (ex. le
// helper `require_get` d'es-toolkit) dans le chunk consommateur (chart.tsx) avec
// une référence cassée → « require_get is not a function » au 1er rendu d'un
// chart en prod. Les regrouper évite le split inter-chunks des modules CJS, tout
// en gardant Recharts hors du bundle d'entrée (chargé à la 1re étape avec chart).
manualChunks(id: string) {
if (
/node_modules\/(recharts|es-toolkit|victory-vendor|d3-[^/]+|internmap|decimal\.js-light)\//.test(
id,
)
) {
return 'recharts'
}
},
},
},
},
})