-
Notifications
You must be signed in to change notification settings - Fork 20
/
Copy pathvite.config.lib.ts
84 lines (77 loc) · 1.85 KB
/
vite.config.lib.ts
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
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
/// <reference types="vitest" />
import { defineConfig } from "vite";
import react from "@vitejs/plugin-react";
import libCss from "vite-plugin-libcss";
import viteTsConfigPaths from "vite-tsconfig-paths";
// eslint-disable-next-line @nx/enforce-module-boundaries
import packageJson from "../../package.json";
const justSrc = [
/\/src\/.*\.js$/,
/\/src\/.*\.jsx$/,
/\/src\/.*\.ts$/,
/\/src\/.*\.tsx$/
];
const dependencyKeys = Object.keys(packageJson.dependencies).filter(
item => item !== "node-interval-tree"
);
export default defineConfig({
cacheDir: "./node_modules/.vite/ove",
plugins: [
react({ include: /\.(mdx|js|jsx|ts|tsx)$/ }),
libCss(),
viteTsConfigPaths({
root: "../../"
})
],
esbuild: {
loader: "jsx",
include: justSrc,
exclude: [],
keepNames: true,
minifyIdentifiers: false,
minifySyntax: false
},
optimizeDeps: {
esbuildOptions: {
loader: {
".js": "jsx",
".ts": "tsx"
}
}
},
// Uncomment this if you are using workers.
// worker: {
// plugins: [
// viteTsConfigPaths({
// root: '../../',
// }),
// ],
// },
// Configuration for building your library.
// See: https://vitejs.dev/guide/build.html#library-mode
build: {
lib: {
// Could also be a dictionary or array of multiple entry points.
entry: "src/index.js",
name: "ove",
fileName: "index"
// Change this to the formats you want to support.
// Don't forget to update your package.json as well.
},
copyPublicDir: false,
rollupOptions: {
// External packages that should not be bundled into your library.
external: dependencyKeys,
output: [
{
format: "cjs",
dir: "./dist/lib/"
},
{
format: "es",
dir: "./dist/lib/"
}
]
}
}
});