-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathvite.config.js
More file actions
79 lines (76 loc) · 1.78 KB
/
vite.config.js
File metadata and controls
79 lines (76 loc) · 1.78 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
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
import { dirname, resolve } from 'node:path'
import { fileURLToPath } from 'node:url'
import { defineConfig, transformWithEsbuild } from 'vite'
import vue from '@vitejs/plugin-vue'
import dts from 'vite-plugin-dts'
import tailwindcss from '@tailwindcss/vite'
const __dirname = dirname(fileURLToPath(import.meta.url))
const esbuildMinify = {
name: 'minify-plugin',
renderChunk(code) {
return transformWithEsbuild(code, 'index.js', {
minify: true,
treeShaking: true,
})
}
}
export default defineConfig({
define: {
'process.env.NODE_ENV': JSON.stringify('production')
},
plugins: [
vue({
template: {
compilerOptions: {
whitespace: 'preserve',
isCustomElement: tag => tag.includes('-')
}
}
}),
dts({ rollupTypes: true }),
tailwindcss()
],
resolve: {
alias: {
vue: 'vue/dist/vue.esm-bundler.js'
}
},
build: {
minify: false,
lib: {
entry: resolve(__dirname, 'src/index.ts'),
name: 'VVPlot',
fileName: 'vvplot',
cssFileName: "style"
},
rollupOptions: {
external: ['vue'],
output: [
{
format: 'es',
entryFileNames: 'vvplot.esm.js',
minifyInternalExports: false,
},
{
format: 'es',
entryFileNames: 'vvplot.esm.min.js',
plugins: [esbuildMinify]
},
{
format: 'iife',
name: 'VVPlot',
entryFileNames: 'vvplot.global.js',
minifyInternalExports: false,
globals: { vue: 'Vue' },
},
{
format: 'iife',
name: 'VVPlot',
entryFileNames: 'vvplot.global.min.js',
globals: { vue: 'Vue' },
plugins: [esbuildMinify]
},
],
},
},
})