-
Notifications
You must be signed in to change notification settings - Fork 0
/
vite.config.ts
31 lines (29 loc) · 1.07 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
/// <reference types="vitest" />
import { defineConfig } from "vite";
import dts from "vite-plugin-dts";
import { name, peerDependencies } from "./package.json";
export default defineConfig({
define: {
global: {},
"process.env": {},
},
build: {
lib: {
entry: "./src/index.ts", // Specifies the entry point for building the library.
name: name, // Sets the name of the generated library.
fileName: (format) => `index.${format}.js`, // Generates the output file name based on the format.
formats: ["cjs", "es"], // Specifies the output formats (CommonJS and ES modules).
},
rollupOptions: {
external: Object.keys(peerDependencies), // Excludes peer dependencies from the bundle.
},
sourcemap: true, // Generates source maps for debugging.
emptyOutDir: true, // Clears the output directory before building.
},
plugins: [dts()], // Uses the 'vite-plugin-dts' plugin for generating TypeScript declaration files (d.ts).
test: {
globals: true,
environment: "jsdom",
setupFiles: "./src/tests/setup-tests.ts",
},
});