-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathvite.config.ts
More file actions
57 lines (55 loc) · 1.39 KB
/
vite.config.ts
File metadata and controls
57 lines (55 loc) · 1.39 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
50
51
52
53
54
55
56
57
/// <reference types="vitest" />
/// <reference types="vite/client" />
import { defineConfig } from "vite";
import react from "@vitejs/plugin-react";
// https://vitejs.dev/config/
export default defineConfig({
plugins: [
react({
jsxRuntime: "classic"
})
],
define: { "process.env": { NODE_ENV: "production" } },
build: {
minify: true,
sourcemap: true,
lib: {
name: "OgmaReact",
entry: "./src/index.ts",
formats: ["es", "cjs", "umd"],
fileName: (format) => {
if (format === "umd") return `index.umd.js`;
if (format === "cjs") return `index.cjs`;
return `index.mjs`;
}
},
rollupOptions: {
external: ["@linkurious/ogma", "react", "react-dom", "react-dom/server"],
output: {
globals: {
react: "React",
"react-dom": "ReactDOM",
"react-dom/server": "ReactDOMServer",
"@linkurious/ogma": "Ogma"
}
}
}
},
esbuild: {
jsxInject: "import React from 'react';",
jsx: "automatic"
},
test: {
globals: true,
environment: "jsdom",
setupFiles: "./test/unit/setup.ts",
include: ["test/unit/**/*.test.{ts,tsx}"],
exclude: ["test/e2e/**", "node_modules", "dist"],
coverage: {
reporter: ["json", "cobertura"],
include: ["src/**/*.{ts,tsx}"],
all: true,
reportsDirectory: "reports/coverage"
}
}
});