-
Notifications
You must be signed in to change notification settings - Fork 8
/
vite.config.ts
69 lines (66 loc) · 1.59 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
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
/// <reference types="vitest" />
import { defineConfig } from "vite";
import react from "@vitejs/plugin-react";
import path, { resolve } from "path";
import dts from "vite-plugin-dts";
// https://vitejs.dev/config/
export default defineConfig({
plugins: [
react({
babel: {
plugins: [["babel-plugin-styled-components", { displayName: false }]],
env: {
development: {
plugins: [["babel-plugin-styled-components", { displayName: true }]],
},
},
},
}),
dts({
include: ["src/"],
exclude: ["**/*.stories.ts", "**/*.stories.tsx", "**/*.test.ts", "**/*.test.tsx"],
}),
],
resolve: {
alias: {
"@": path.resolve(__dirname, "./src"),
},
},
build: {
minify: false,
lib: {
entry: resolve(__dirname, "src/index.ts"),
name: "click-ui",
formats: ["es", "umd"],
fileName: format => `click-ui.${format}.js`,
},
rollupOptions: {
// Add _all_ external dependencies here
external: [
"react",
"react-dom",
"styled-components",
"**/*.stories.ts",
"**/*.stories.tsx",
"**/*.test.ts",
"**/*.test.tsx",
"react/jsx-runtime",
],
output: {
globals: {
react: "React",
"styled-components": "styled",
"react-dom": "ReactDOM",
},
},
},
},
test: {
environment: "jsdom",
include: ["**/*.test.{ts,tsx}"],
globals: true,
watch: false,
exclude: ["node_modules"],
setupFiles: ["@testing-library/jest-dom", "./setupTests.ts"],
}
});