-
-
Notifications
You must be signed in to change notification settings - Fork 60
/
vite.config.ts
42 lines (41 loc) · 1010 Bytes
/
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
import { resolve } from "path";
import { defineConfig } from "vitest/config";
import react from "@vitejs/plugin-react";
import pkg from "./package.json";
export default defineConfig({
plugins: [react({ jsxRuntime: "classic" })],
build: {
target: "ES2017",
lib: {
entry: resolve(__dirname, "src/index.ts"),
fileName: (format, name) => `${name}.${format === "umd" ? "cjs" : "mjs"}`,
},
rollupOptions: {
external: Object.keys(pkg.peerDependencies),
input: "./src/index.ts",
output: [
{
format: "es",
preserveModules: true,
preserveModulesRoot: "src",
globals: {
react: "React",
"react-dom": "ReactDOM",
},
},
{
format: "umd",
name: "PhosphorReact",
globals: {
react: "React",
"react-dom": "ReactDOM",
},
},
],
},
},
test: {
globals: true,
environment: "jsdom",
},
});