-
Notifications
You must be signed in to change notification settings - Fork 0
/
vite.config.ts
62 lines (61 loc) · 1.93 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
54
55
56
57
58
59
60
61
62
import path from 'node:path'
import { defineConfig } from 'vite'
import vue from '@vitejs/plugin-vue'
import ESLint from '@nabla/vite-plugin-eslint'
import AutoImport from 'unplugin-auto-import/vite'
// https://vitejs.dev/config/
export default ({ mode }: { mode: string }) => {
return defineConfig({
build: {
lib: {
name: '@volverjs/ui-vue',
entry: path.resolve(__dirname, 'src/index.ts'),
},
rollupOptions: {
external: ['vue'],
output: {
globals: {
vue: 'Vue',
},
},
},
},
base: mode === 'development' ? './' : '/ui-vue/',
plugins: [
vue(),
ESLint(),
AutoImport({
// global imports to register
imports: ['vue', '@vueuse/core'],
// Auto import for module exports under directories
// by default it only scan one level of modules under the directory
dirs: ['./src/composables/**', './src/utils/'],
dts: true,
eslintrc: {
enabled: true,
},
}),
],
resolve: {
alias: {
'@': path.resolve(__dirname, './src'),
/*
* Replace jest-matcher-utils
* (required by @storybook/jest) that
* creates an error in production
* because it use the commonjs module chalk
*/
'jest-matcher-utils': path.resolve(
__dirname,
'./vendor/jest-matcher-utils/index.ts',
),
},
},
optimizeDeps: {
exclude: ['@volverjs/style'],
force: true,
},
// https://github.com/storybookjs/storybook/issues/25256
assetsInclude: ['/sb-preview/runtime.js'],
})
}