-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathvite.config.js
52 lines (49 loc) · 1.15 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
import { defineConfig } from 'vite'
import { svelte } from '@sveltejs/vite-plugin-svelte'
import sveltePreprocess from 'svelte-preprocess'
import eslintPlugin from 'vite-plugin-eslint'
console.log('[NODE_ENV]', process.env.NODE_ENV)
const isProd = process.env.NODE_ENV === 'production'
let lib = {}
let customElement = false
if (isProd) {
lib = {
entry: 'src/components/index.js',
name: 'MswTools',
formats: ['umd', 'es'],
fileName: 'msw-tools.min',
}
customElement = true
}
// https://vitejs.dev/config/
export default defineConfig({
server: {
// port: 3033
},
build: {
lib,
minify: 'terser',
terserOptions: {
compress: {
drop_console: false,
drop_debugger: true,
},
},
},
define: {
'process.env': {},
},
plugins: [
svelte({
compilerOptions: {
// You can optionally set 'customElement' to 'true' to compile
// your components to custom elements (aka web elements)
customElement,
},
preprocess: sveltePreprocess(),
}),
eslintPlugin({
include: ['src/**/*.js', 'src/**/*.svelte', 'src/*.js', 'src/*.svelte'],
}),
],
})