-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathvite.config.js
More file actions
39 lines (34 loc) · 800 Bytes
/
vite.config.js
File metadata and controls
39 lines (34 loc) · 800 Bytes
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
import { defineConfig } from "vite";
import { createHtmlPlugin } from "vite-plugin-html";
import { resolve } from "path";
import dts from "vite-plugin-dts";
const dev = () => {
const API_KEY = process.env.DG_API_KEY;
if (!API_KEY) {
throw new Error("missing DG_API_KEY environment variable");
}
return {
define: {
API_KEY: JSON.stringify(API_KEY),
},
plugins: createHtmlPlugin({
template: "example/index.html",
}),
};
};
const prod = () => ({
build: {
lib: {
entry: [
resolve(__dirname, "src/index.ts"),
resolve(__dirname, "src/hoop.ts"),
],
formats: ["es"],
},
},
plugins: [dts()],
});
// https://vitejs.dev/config/
export default defineConfig(({ mode }) =>
mode === "development" ? dev() : prod(),
);