-
Notifications
You must be signed in to change notification settings - Fork 15
Expand file tree
/
Copy pathvite.config.ts
More file actions
47 lines (42 loc) · 1.16 KB
/
vite.config.ts
File metadata and controls
47 lines (42 loc) · 1.16 KB
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 { fileURLToPath, URL } from 'node:url'
import { defineConfig } from 'vite'
import vue from '@vitejs/plugin-vue'
export default defineConfig(({ mode }) => {
const isLibMode = mode === 'lib'
const baseConfig = {
plugins: [vue(), ...(isLibMode ? [] : [])],
resolve: { alias: { '@': fileURLToPath(new URL('./src', import.meta.url)) } },
define: { __APP_VERSION__: JSON.stringify(process.env.npm_package_version) },
}
if (isLibMode) {
return {
...baseConfig,
build: {
lib: {
entry: fileURLToPath(new URL('./src/index.ts', import.meta.url)),
name: 'VueWebsitePageBuilder',
fileName: (format) =>
`vue-website-page-builder.${format === 'es' ? 'js' : format === 'umd' ? 'umd.cjs' : 'js'}`,
},
rollupOptions: {
external: ['vue'],
output: {
globals: {
vue: 'Vue',
},
assetFileNames: 'style.css',
},
},
emptyOutDir: true,
cssCodeSplit: true,
},
esbuild: {
target: 'esnext',
},
}
}
return {
...baseConfig,
server: { port: 9999 },
}
})