-
Notifications
You must be signed in to change notification settings - Fork 0
/
vite.config.js
50 lines (47 loc) · 1.02 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
import mpa from 'vite-plugin-mpa';
import vue from '@vitejs/plugin-vue';
import * as path from 'path';
import vitePluginImp from 'vite-plugin-imp';
import { viteVConsole } from 'vite-plugin-vconsole';
// https://vitejs.dev/config/
export default ({ mode }) => {
let plugins = [
vue(),
vitePluginImp({
libList: [
{
libName: 'vant',
style(name) {
if (/CompWithoutStyleFile/i.test(name)) {
// This will not import any style file
return false;
}
return `vant/es/${name}/style/index.js`;
},
},
],
}),
mpa({
open: '',
scanDir: 'src/pages',
scanFile: 'main.js',
filename: 'index.html',
}),
];
if (mode !== 'release') {
plugins = [
...plugins,
viteVConsole({
entry: path.resolve('src/app.js'),
localEnabled: true,
enabled: true,
}),
];
}
return {
optimizeDeps: {
entries: 'vant/es/**/*.js',
},
plugins,
};
};