91 lines
2.1 KiB
TypeScript
91 lines
2.1 KiB
TypeScript
import { defineConfig } from "vite";
|
|
import react from "@vitejs/plugin-react";
|
|
|
|
// https://vite.dev/config/
|
|
export default defineConfig({
|
|
plugins: [react()],
|
|
|
|
// Node.js 호환성 문제 해결
|
|
define: {
|
|
global: "globalThis",
|
|
},
|
|
|
|
// Node.js 모듈 호환성 설정
|
|
resolve: {
|
|
alias: {
|
|
stream: "stream-browserify",
|
|
buffer: "buffer",
|
|
},
|
|
// 중복 모듈 해결을 위한 dedupe 설정
|
|
dedupe: ["@wendellhu/redi"],
|
|
},
|
|
|
|
// 의존성 최적화 설정
|
|
optimizeDeps: {
|
|
include: [
|
|
// REDI 중복 로드 방지를 위해 명시적으로 포함
|
|
"@wendellhu/redi",
|
|
],
|
|
exclude: [
|
|
// Univer 관련 모듈만 제외
|
|
"@univerjs/core",
|
|
"@univerjs/design",
|
|
"@univerjs/ui",
|
|
"@univerjs/sheets",
|
|
"@univerjs/sheets-ui",
|
|
"@univerjs/docs",
|
|
"@univerjs/docs-ui",
|
|
"@univerjs/engine-render",
|
|
"@univerjs/engine-formula",
|
|
"@univerjs/sheets-formula",
|
|
"@univerjs/sheets-formula-ui",
|
|
"@univerjs/sheets-numfmt",
|
|
"@univerjs/sheets-numfmt-ui",
|
|
],
|
|
},
|
|
|
|
// 빌드 설정
|
|
build: {
|
|
rollupOptions: {
|
|
external: [],
|
|
output: {
|
|
manualChunks: {
|
|
// REDI를 별도 청크로 분리하여 중복 방지
|
|
redi: ["@wendellhu/redi"],
|
|
// Univer 관련 라이브러리를 별도 청크로 분리
|
|
"univer-core": [
|
|
"@univerjs/core",
|
|
"@univerjs/design",
|
|
"@univerjs/engine-render",
|
|
"@univerjs/engine-formula",
|
|
],
|
|
"univer-sheets": [
|
|
"@univerjs/sheets",
|
|
"@univerjs/sheets-ui",
|
|
"@univerjs/sheets-formula",
|
|
"@univerjs/sheets-formula-ui",
|
|
"@univerjs/sheets-numfmt",
|
|
"@univerjs/sheets-numfmt-ui",
|
|
],
|
|
"univer-docs": ["@univerjs/docs", "@univerjs/docs-ui"],
|
|
"univer-ui": ["@univerjs/ui"],
|
|
},
|
|
},
|
|
},
|
|
},
|
|
|
|
// 서버 설정
|
|
server: {
|
|
fs: {
|
|
strict: false,
|
|
},
|
|
},
|
|
|
|
// @ts-ignore - vitest config
|
|
test: {
|
|
globals: true,
|
|
environment: "jsdom",
|
|
setupFiles: ["./src/setupTests.ts"],
|
|
},
|
|
});
|