-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathvite.config.ts
44 lines (42 loc) · 1.16 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
import del from 'rollup-plugin-delete'
import dts from 'vite-plugin-dts'
import vue from '@vitejs/plugin-vue'
import { defineConfig } from 'vite'
import { resolve } from 'path'
// https://vitejs.dev/config/
export default defineConfig({
plugins: [
del({ targets: 'dist/favicon.ico', hook: 'writeBundle' }),
vue(), // https://github.com/qmhc/vite-plugin-dts#options
dts({
exclude: ['playground/**'],
beforeWriteFile: function (filePath, content) {
// Write definition files in /dist/types/ instead of /dist/src/
const finalFilePath = filePath.replace('/dist/src/', '/dist/types/')
return { filePath: finalFilePath, content }
}
})
],
resolve: {
alias: {
'@': resolve(__dirname, './src'),
'@playground': resolve(__dirname, './playground'),
'@root': resolve(__dirname, './')
}
},
build: {
lib: {
entry: resolve(__dirname, 'src/createLoader.ts'),
name: 'PromiseLoadingHandler',
fileName: (format) => `promise-loading-handler.${format}.js`
},
rollupOptions: {
external: ['vue'],
output: {
globals: {
vue: 'Vue'
}
}
}
}
})