forked from cloudforet-io/mirinae
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathvite.config.js
63 lines (61 loc) · 1.66 KB
/
vite.config.js
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
import path from 'path';
import { viteCommonjs } from '@originjs/vite-plugin-commonjs';
import vuePlugin from '@vitejs/plugin-vue2';
import copy from 'rollup-plugin-copy';
import { defineConfig } from 'vite';
import StylelintPlugin from 'vite-plugin-stylelint';
export default defineConfig(({ mode }) => ({
optimizeDeps: {
exclude: mode === 'test' ? ['vue'] : [],
},
build: {
lib: {
entry: {
mirinae: path.resolve(__dirname, './src/index.ts'),
hooks: path.resolve(__dirname, './src/hooks/index.ts'),
},
name: 'Mirinae',
fileName: (format, entryName) => `${entryName}.mjs`,
formats: ['es'],
},
rollupOptions: {
external: [
'vue',
'vue-router',
'vue-i18n',
'@amcharts/amcharts4',
],
output: {
globals: {
vue: 'Vue',
'vue-i18n': 'vue-i18n',
},
},
},
},
plugins: [
viteCommonjs(),
vuePlugin(),
StylelintPlugin({
include: ['src/**/*.{css,vue,pcss,scss}'],
exclude: ['node_modules'],
lintOnStart: false,
emitErrorAsWarning: true,
}),
copy({
targets: [
{ src: 'css', dest: 'dist/' },
],
}),
],
test: {
globals: true,
environment: 'jsdom',
include: ['./src/**/__tests__/**/*.+(ts|js)'],
},
resolve: {
alias: {
'@': path.resolve(__dirname, './src'),
},
},
}));