-
Notifications
You must be signed in to change notification settings - Fork 0
/
vite.config.plugin.ts
58 lines (55 loc) · 1.52 KB
/
vite.config.plugin.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
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
import { defineConfig } from "vite";
import react from "@vitejs/plugin-react";
import dns from "dns";
import path from "path";
import { ViteEjsPlugin } from "vite-plugin-ejs";
import cssInjectedByJsPlugin from "vite-plugin-css-injected-by-js";
dns.setDefaultResultOrder("verbatim");
const isProduction = process.env.NODE_ENV === "production";
const basePath = isProduction ? "/webchat-plugin" : "";
export default defineConfig({
// { fastRefresh: false }
plugins: [
cssInjectedByJsPlugin(),
ViteEjsPlugin((viteConfig) => ({
// viteConfig is the current Vite resolved config
basePath: basePath,
})),
react({
jsxRuntime: "classic",
}),
],
mode: "production",
publicDir: "public",
base: basePath,
build: {
// minify: "terser",
// manifest: false,
target: "es2015",
ssr: false,
emptyOutDir: false,
copyPublicDir: false,
rollupOptions: {
input: {
"spinoco-webchat-plugin": path.resolve(__dirname, "src/spinoco-webchat-plugin.tsx"),
},
output: {
entryFileNames: `dist/[name].js`,
chunkFileNames: `dist/[name].js`,
assetFileNames: `dist/[name].[ext]`,
},
},
},
server: {
https: false,
cors: false,
hmr: true,
port: 4444,
host: "0.0.0.0",
},
preview: {
cors: false,
port: 4444,
host: "0.0.0.0",
},
});