-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathvite.lib.config.mts
More file actions
49 lines (48 loc) · 1.08 KB
/
vite.lib.config.mts
File metadata and controls
49 lines (48 loc) · 1.08 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
import react from "@vitejs/plugin-react";
import { defineConfig } from "vite";
import dts from "vite-plugin-dts";
import { viteStaticCopy } from "vite-plugin-static-copy";
export default defineConfig({
plugins: [
react(),
dts({
entryRoot: "packages/library/src",
include: ["packages/library/src/**/*"],
exclude: [
"packages/library/src/**/*.test.ts",
"packages/library/src/**/*.test.tsx",
"packages/library/src/__tests__/**",
],
tsconfigPath: "packages/library/tsconfig.json",
}),
viteStaticCopy({
targets: [
{
src: "README.md",
dest: "../",
},
],
}),
],
build: {
outDir: "packages/library/dist",
emptyOutDir: true,
lib: {
entry: {
"react-socket": "packages/library/src/index.ts",
"react-socket-inspector": "packages/library/src/inspector/index.ts",
},
formats: ["es"],
fileName: (_format, entryName) => `${entryName}.es.js`,
},
rollupOptions: {
external: ["react", "react-dom", "react/jsx-runtime"],
output: {
globals: {
react: "React",
"react-dom": "ReactDOM",
},
},
},
},
});