generated from theholocron/react-template
-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathvite.config.ts
37 lines (36 loc) · 951 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 * as path from "node:path";
import { defineConfig } from "vite";
import react from "@vitejs/plugin-react";
/*
* @see https://vitejs.dev/config/
*/
export default defineConfig({
build: {
lib: {
entry: path.resolve(__dirname, "src/index.ts"), // Entry point of your library
name: "nextjs-template",
formats: ["es", "cjs"], // Specify formats (ESM and CommonJS)
fileName: (format) => `nextjs-template.${format}.js`,
},
rollupOptions: {
external: ["react", "nextjs-dom"], // Externalize peer dependencies
output: {
globals: {
react: "React",
"nextjs-dom": "ReactDOM",
},
},
},
},
plugins: [react()],
resolve: {
alias: {
"@": path.resolve(__dirname, "./src"), // Example alias, adjust as needed
},
},
test: {
globals: true,
environment: "jsdom", // Use jsdom for testing React components
setupFiles: "./test.setup.ts", // Optional setup file for additional configurations
},
});