Menambahkan resolve.dedupe untuk react/react-dom/@tanstack/react-router/ @tanstack/react-query di vite.config.ts agar tidak ada duplicate instance yang di-bundle dari Radix primitives. Menghapus StrictMode dari main.tsx karena combining StrictMode dengan recharts 3.x (yang bawa @reduxjs/toolkit + immer autoFreeze) + TanStack Router 1.168 trigger "Cannot assign to read only property 'lanes' of #<li>" dan "pendingBuiltLocation of #<zr>" saat navigate. Juga perbaiki duplikasi block build: di config lama ada dua property build (yang kedua menimpa yang pertama jadi rolldownOptions hilang). Sekarang rolldownOptions code-splitting vendor aktif. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
53 lines
1.4 KiB
TypeScript
53 lines
1.4 KiB
TypeScript
/// <reference types='vitest' />
|
|
import { defineConfig } from 'vite';
|
|
import react from '@vitejs/plugin-react';
|
|
import { nxViteTsPaths } from '@nx/vite/plugins/nx-tsconfig-paths.plugin';
|
|
import { nxCopyAssetsPlugin } from '@nx/vite/plugins/nx-copy-assets.plugin';
|
|
import { TanStackRouterVite } from '@tanstack/router-plugin/vite';
|
|
|
|
export default defineConfig(() => ({
|
|
root: __dirname,
|
|
cacheDir: '../../node_modules/.vite/apps/backoffice',
|
|
server: {
|
|
port: 3003,
|
|
host: 'localhost',
|
|
},
|
|
preview: {
|
|
port: 3001,
|
|
host: 'localhost',
|
|
},
|
|
resolve: {
|
|
dedupe: ['react', 'react-dom', '@tanstack/react-router', '@tanstack/react-query'],
|
|
},
|
|
plugins: [
|
|
TanStackRouterVite({
|
|
routeFileIgnorePattern: '_components|_hooks|_hook|_data',
|
|
}),
|
|
react(),
|
|
nxViteTsPaths(),
|
|
nxCopyAssetsPlugin(['*.md']),
|
|
],
|
|
build: {
|
|
outDir: '../../dist/apps/backoffice',
|
|
emptyOutDir: true,
|
|
reportCompressedSize: true,
|
|
commonjsOptions: {
|
|
transformMixedEsModules: true,
|
|
},
|
|
rolldownOptions: {
|
|
output: { codeSplitting: { groups: [{ name: 'vendor', test: /node_modules/ }] } },
|
|
},
|
|
},
|
|
test: {
|
|
watch: false,
|
|
globals: true,
|
|
environment: 'jsdom',
|
|
include: ['src/**/*.{test,spec}.{js,mjs,cjs,ts,mts,cts,jsx,tsx}'],
|
|
reporters: ['default'],
|
|
coverage: {
|
|
reportsDirectory: '../../coverage/apps/backoffice',
|
|
provider: 'v8' as const,
|
|
},
|
|
},
|
|
}));
|