-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathvite.config.mts
More file actions
62 lines (60 loc) · 1.75 KB
/
Copy pathvite.config.mts
File metadata and controls
62 lines (60 loc) · 1.75 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
/// <reference types='vitest' />
import { defineConfig } from 'vite';
import react from '@vitejs/plugin-react';
import dts from 'vite-plugin-dts';
import * as fs from 'fs';
import * as path from 'path';
// The headless core (`double-eighteen`) is consumed from its freshly built dist
// when developed inside the Warp monorepo (sibling submodule). In a standalone
// checkout that sibling isn't present, so we fall back to normal resolution from
// node_modules (the published `double-eighteen` package).
const siblingCore = path.resolve(
import.meta.dirname,
'../double-eighteen/dist/index.js'
);
const coreAlias: Record<string, string> = fs.existsSync(siblingCore)
? { 'double-eighteen': siblingCore }
: {};
export default defineConfig(() => ({
root: import.meta.dirname,
cacheDir: '../../node_modules/.vite/vendor/double-eighteen-react',
resolve: {
alias: {
...coreAlias,
},
},
plugins: [
react(),
dts({
entryRoot: 'src',
tsconfigPath: path.join(import.meta.dirname, 'tsconfig.lib.json'),
include: ['src/**/*.ts', 'src/**/*.tsx'],
exclude: ['src/**/*.spec.ts', 'src/**/*.spec.tsx', 'dev/**', 'e2e/**'],
}),
],
build: {
outDir: './dist',
emptyOutDir: true,
reportCompressedSize: true,
commonjsOptions: {
transformMixedEsModules: true,
},
lib: {
entry: 'src/index.ts',
name: 'double-eighteen-react',
fileName: 'index',
formats: ['es' as const],
},
rolldownOptions: {
external: ['react', 'react-dom', 'react/jsx-runtime', 'double-eighteen'],
},
},
test: {
name: 'double-eighteen-react',
watch: false,
globals: true,
environment: 'jsdom',
include: ['src/**/*.{test,spec}.{ts,tsx}'],
reporters: ['default'],
},
}));