-
Notifications
You must be signed in to change notification settings - Fork 0
/
vite.config.web.ts
65 lines (62 loc) · 2.09 KB
/
vite.config.web.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
59
60
61
62
63
64
65
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: isProduction ? "production" : "development",
publicDir: "public",
base: basePath,
build: {
// minify: "terser",
// manifest: false,
target: "es2015",
ssr: false,
emptyOutDir: true,
copyPublicDir: true,
rollupOptions: {
input: {
"spinoco-webchat-plugin": path.resolve(__dirname, "src/spinoco-webchat-plugin.tsx"),
index: path.resolve(__dirname, "index.html"),
basic: path.resolve(__dirname, "examples/basic.html"),
mockbot: path.resolve(__dirname, "examples/mockbot.html"),
lottie: path.resolve(__dirname, "examples/lottie.html"),
slevomat: path.resolve(__dirname, "examples/slevomat.html"),
zasilkovna: path.resolve(__dirname, "examples/border-only.html"),
zasilkovna_minified: path.resolve(__dirname, "examples/border-only-minified.html"),
},
output: {
entryFileNames: `assets/[name].js`,
chunkFileNames: `assets/[name].js`,
assetFileNames: `assets/[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",
},
});