-
Notifications
You must be signed in to change notification settings - Fork 4
/
vite.config.js
57 lines (56 loc) · 1.62 KB
/
vite.config.js
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
import nodeResolve from "@rollup/plugin-node-resolve";
import replace from "@rollup/plugin-replace";
import terser from "@rollup/plugin-terser";
import { rollupPluginHTML } from "@web/rollup-plugin-html";
import { defineConfig } from "vite";
import config from "./config.json";
import packageInfo from "./package.json";
// https://vitejs.dev/config/
/** @type {import('vite').UserConfig} */
export default defineConfig(({ command }) => ({
build: {
output: {
dir: "dist",
sourcemap: true,
},
inputs: {
index: "/index.html",
src: "src",
},
lib: {
entry: "src/static-app.js",
formats: ["es"],
},
rollupOptions: {
external:
command === "serve"
? [/^lit/, "yjs", "y-websocket", "y-quill", "quill"]
: [], // Don't bundle node_modules in dev mode
plugins: [
replace({
values: {
"{SBF_MANAGER}": config.sbfManagerHost,
"{OIDC_CLIENT_ID}": config.oidc_client_id,
"{YJS_ADDRESS}": config.yjs_socket_url,
"{YJS_RESOURCE_PATH}": config.yjs_resource_path,
"{STATUSBAR_SUBTITLE}": "v" + packageInfo.version,
"{CONTACT_SERVICE_URL}": config.contact_service_url,
"{RASA_URL}": config.rasaEndpoint,
"{YJS_PROTOCOL}": config.yjs_socket_protocol,
"env:development": "env:production",
},
preventAssignment: true,
delimiters: ["", ""],
}),
nodeResolve(),
rollupPluginHTML({
input: "index.html",
}),
terser(),
],
},
},
server: {
port: 8082,
},
}));