-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathvite.config.ts
37 lines (35 loc) · 907 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
import { defineConfig } from "vite";
import react from "@vitejs/plugin-react";
import * as path from "path";
import pkg from "./package.json";
const currentWorkingPath = process.cwd();
/**
* This file is based on the recommendation from vitejs.dev
* @see https://vitejs.dev/guide/build.html#library-mode
* @see https://vitejs.dev/config/
*/
export default defineConfig({
plugins: [react()],
build: {
lib: {
entry: path.join(currentWorkingPath, "src/index.ts"),
name: pkg.name,
fileName: (format) => `${pkg.name}.${format}.js`,
},
rollupOptions: {
/**
* Externalize deps that shouldn't be bundled
* into your library
*/
external: ["react", "react-dom"],
output: {
/**
* Provide global variables to use in the UMD build
*/
globals: {
react: "React",
},
},
},
},
});