-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathvite.config.widget.js
More file actions
41 lines (40 loc) · 1.03 KB
/
vite.config.widget.js
File metadata and controls
41 lines (40 loc) · 1.03 KB
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
import { defineConfig } from "vite";
import react from "@vitejs/plugin-react";
import { resolve } from "path";
import alias from "@rollup/plugin-alias";
export default defineConfig({
plugins: [
react(),
alias({
entries: [{ find: "@", replacement: resolve(__dirname, "src") }],
}),
],
css: {
postcss: "./postcss.config.js", // Ensure PostCSS processes CSS
},
define: {
"process.env.NODE_ENV": JSON.stringify("production"),
},
build: {
lib: {
entry: resolve(__dirname, "src/web-component.tsx"),
name: "Widget",
fileName: () => "widget.umd.js",
formats: ["umd"],
},
cssCodeSplit: false, // Don't split CSS - include it all inline
rollupOptions: {
external: ["react", "react-dom"],
output: {
globals: {
react: "React",
"react-dom": "ReactDOM",
},
format: "umd",
},
treeshake: false, // Disable tree shaking to ensure side effects are included
},
outDir: "public",
emptyOutDir: false,
},
});