-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
vite.config.ts
53 lines (48 loc) · 1.11 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
48
49
50
51
52
53
import path, { resolve } from 'node:path'
import Vue from '@vitejs/plugin-vue'
import { defineConfig } from 'vite'
// https://github.com/qmhc/vite-plugin-dts
import dtsPlugin from 'vite-plugin-dts'
// https://github.com/sxzz/unplugin-vue-macros
import VueMacros from 'unplugin-vue-macros/vite'
import * as pkg from './package.json'
const externals = [
...Object.keys(pkg.peerDependencies || {}),
]
export default defineConfig({
plugins: [
dtsPlugin(),
VueMacros({
plugins: {
vue: Vue({
include: [/\.vue$/, /\.md$/],
}),
},
}),
],
resolve: {
alias: {
'@': resolve(__dirname, 'src'),
},
},
build: {
lib: {
entry: path.resolve(__dirname, 'src/index.ts'),
formats: ['es', 'umd'],
name: 'change-name',
fileName: format => `index.${format}.js`,
},
rollupOptions: {
external: externals,
output: {
format: 'esm',
dir: './dist',
// Provide global variables to use in the UMD build
// for externalized deps
globals: {
vue: 'Vue',
},
},
},
},
})