-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathvite.lib.config.ts
More file actions
42 lines (40 loc) · 1.23 KB
/
Copy pathvite.lib.config.ts
File metadata and controls
42 lines (40 loc) · 1.23 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
import { fileURLToPath, URL } from 'node:url';
import { defineConfig } from 'vite';
import react from '@vitejs/plugin-react';
import dts from 'vite-plugin-dts';
const resolve = (p: string) => fileURLToPath(new URL(p, import.meta.url));
// Library build: emits only the reusable pieces (the `cursor/canvas` shim and
// the web host runtime), never the demo app. The demo site is built by the
// default `vite.config.ts`. Peer deps stay external so consumers supply their
// own React/Mantine and we don't ship duplicate copies.
export default defineConfig({
plugins: [
react(),
dts({
// Flatten output to dist/{shim,runtime}/* and keep tests/helpers out.
entryRoot: 'src',
include: ['src/shim', 'src/runtime'],
exclude: ['src/**/__tests__/**', 'src/**/*.test.*', 'src/test/**'],
}),
],
build: {
lib: {
entry: {
'cursor-canvas': resolve('./src/shim/cursor-canvas.tsx'),
runtime: resolve('./src/runtime/index.tsx'),
},
formats: ['es', 'cjs'],
},
rollupOptions: {
external: [
'react',
'react/jsx-runtime',
'react-dom',
'react-dom/client',
'@mantine/core',
'@mantine/charts',
'recharts',
],
},
},
});