-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathvite.config.ts
47 lines (44 loc) · 1.08 KB
/
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
38
39
40
41
42
43
44
45
46
47
import { defineConfig } from 'vite'
import { svelte } from '@sveltejs/vite-plugin-svelte'
import cssInjectedByJsPlugin from "vite-plugin-css-injected-by-js"
export default defineConfig(({ mode }) => {
const isDev = (mode === "development")
const argv = process.argv
const componentIndex = argv.indexOf("--component")
const component = componentIndex !== -1 ? argv[componentIndex + 1] : null
let input = "src/dev.ts";
if(!isDev){
if(component === "form"){
input = "src/form.ts";
} else if(component === "ro"){
input = "src/ro.ts";
}
}
return {
build: {
target: "esnext",
outDir: "dist",
minify: true,
rollupOptions: {
input: "src/dev.ts",
output: {
entryFileNames: "index.js",
format: "iife",
},
external: ["medblocks-ui", "medblocks-ui/dist/styles"],
},
},
server: {
open: true,
port: 3000,
},
plugins: [
svelte({
compilerOptions: {
customElement: true,
},
}),
cssInjectedByJsPlugin(),
],
}
});