-
Notifications
You must be signed in to change notification settings - Fork 3
/
vite.config.ts
72 lines (68 loc) · 1.75 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
70
71
72
/// <reference types="vitest" />
/// <reference types="vite/client" />
import react from "@vitejs/plugin-react";
import { defineConfig } from "vite";
import dts from "vite-plugin-dts";
export default defineConfig(({ mode }) => {
return {
plugins: [
react(),
dts({
insertTypesEntry: true,
}),
],
resolve: {
alias: {
components: "/src/components",
utils: "/src/utils",
},
},
build: {
sourcemap: mode === "dev",
lib: {
entry: "src/index.ts",
name: "@avaya/neo-react",
fileName: "avaya-neo-react",
},
// TODO: the css files doesn't seem to usable via the dp, need to figure out why
// TODO: I'm (Joe) a big confused about how/why we need `rollupOptions`. Should probably do further research.
// most likely has to do with "library-mode"
// https://vitejs.dev/config/build-options.html#build-lib
// https://vitejs.dev/guide/build.html#library-mode
rollupOptions: {
external: ["react", "react-dom"],
output: {
globals: {
react: "react",
"react-dom": "ReactDOM",
// other "globals" from old lib:
// "loglevel": "log",
},
assetFileNames: (assetInfo) => {
if (assetInfo.name === "style.css") return "avaya-neo-react.css";
return assetInfo.name;
},
},
},
},
test: {
globals: true,
environment: "jsdom",
setupFiles: "./src/test/setup.ts",
coverage: {
exclude: [
"src/index.ts", // if we included this in the tests it causes a circular dependency
"**/*.d.ts",
"**/*.cy.*",
"**/*.cypresstest.*",
"**/*.test.*",
"**/*.stories.*",
"**/storybook-static/**",
"**/standalone-stories/**",
"**/.storybook/**",
],
reporter: ["text", "json", "json-summary", "html", "lcov"],
},
},
};
});