-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathvite.config.js
47 lines (45 loc) · 1.31 KB
/
vite.config.js
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
import { resolve } from "path";
import { defineConfig } from "vite";
import dts from "vite-plugin-dts";
const config =
process.env.BUILD_FORMAT === "iife"
? defineConfig({
build: {
outDir: "lib/standalone",
target: "es2020",
lib: {
entry: resolve(__dirname, "src/index.ts"),
name: "cashuts",
formats: ["iife"],
fileName: (format) => `nutjar.${format}.js`,
},
sourcemap: true,
},
plugins: [
dts({ tsconfigPath: "./tsconfig.json", outDir: "lib/types" }),
],
})
: defineConfig({
build: {
outDir: "lib",
target: "es2020",
lib: {
entry: resolve(__dirname, "src/index.ts"),
name: "cashuts",
fileName: (format) => `nutjar.${format}.js`,
formats: ["es", "cjs"],
},
rollupOptions: {
output: {},
external: (id) =>
Object.keys(require("./package.json").dependencies || {}).some(
(dep) => id === dep || id.startsWith(`${dep}/`),
),
},
sourcemap: true,
},
plugins: [
dts({ tsconfigPath: "./tsconfig.json", outDir: "lib/types" }),
],
});
export default config;