-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathvite.config.ts
49 lines (48 loc) · 1.43 KB
/
vite.config.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
import react from "@vitejs/plugin-react-swc";
import path from "path";
import peerDepsExternal from "rollup-plugin-peer-deps-external";
import { PluginOption, defineConfig } from "vite";
import dts from "vite-plugin-dts";
import viteTsconfigPaths from "vite-tsconfig-paths";
export default defineConfig({
plugins: [
peerDepsExternal({
includeDependencies: true,
}) as PluginOption,
react(),
dts({
insertTypesEntry: true,
tsconfigPath: path.resolve(__dirname, "./tsconfig.build.json"),
}),
viteTsconfigPaths(),
],
build: {
emptyOutDir: true,
sourcemap: true,
lib: {
entry: path.resolve(__dirname, "src/index.ts"),
name: "react-ooui",
formats: ["es"],
fileName: (format) => `react-ooui.${format}.js`,
},
rollupOptions: {
// We manually add these since they are not directly in package.json, but they end up in the bundle if we don't exclude them.
// Reason for this is using imports for specific components
external: [
"@ant-design/icons",
"lodash/debounce",
"moment",
"dayjs",
"dayjs/plugin/advancedFormat",
"dayjs/plugin/isoWeek",
"dayjs/plugin/timezone",
"dayjs/plugin/duration",
"dayjs/plugin/relativeTime",
"dayjs/plugin/weekday",
"dayjs/plugin/localeData",
"dayjs/plugin/customParseFormat",
"antd/es/alert/ErrorBoundary",
],
},
},
});