-
Notifications
You must be signed in to change notification settings - Fork 14
Expand file tree
/
Copy pathvite.config.mjs
More file actions
39 lines (37 loc) · 819 Bytes
/
vite.config.mjs
File metadata and controls
39 lines (37 loc) · 819 Bytes
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
import { defineConfig } from 'vite'
import { version } from './package.json'
const { MINIFY } = process.env
const PROD = process.env.NODE_ENV === 'production'
export default defineConfig({
build: {
target: 'es2020',
lib: {
entry: 'src/index.js',
name: 'InPageEditPkg',
fileName() {
return `InPageEdit${MINIFY ? '.min' : ''}.js`
},
formats: ['umd'],
},
minify: !!MINIFY,
emptyOutDir: false,
sourcemap: true,
},
define: {
'import.meta.env.__VERSION__': JSON.stringify(
PROD
? version
: `${version}-dev.${new Date().toISOString().split('T')[0].replaceAll('-', '')}`
),
},
mode: process.env.NODE_ENV,
server: {
host: true,
port: 1005,
},
preview: {
host: true,
port: 1225,
cors: true,
},
})