-
Notifications
You must be signed in to change notification settings - Fork 0
/
vite.config.ts
59 lines (57 loc) · 1.86 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
import { defineConfig } from 'vite';
import vue from '@vitejs/plugin-vue';
import AutoImport from 'unplugin-auto-import/vite'
import Components from 'unplugin-vue-components/vite'
import { ElementPlusResolver } from 'unplugin-vue-components/resolvers'
export default defineConfig({
css: {
preprocessorOptions: {
scss: {
additionalData: '@import "./src/assets/scss/global.scss";'
}
}
},
plugins: [
vue({
template: {
compilerOptions: {
isCustomElement: tag => tag.startsWith('ion-')
}
}
}),
AutoImport({
resolvers: [ElementPlusResolver()],
}),
Components({
resolvers: [ElementPlusResolver()],
}),
],
//静态资源服务的文件夹
publicDir: "public",
base: '/',
// 打包配置 npm run build
build:{
//指定输出路径
outDir: "dist",
//生成静态资源的存放路径
assetsDir: "assets",
//小于此阈值的导入或引用资源将内联为 base64 编码,以避免额外的 http 请求。设置为 0 可以完全禁用此项
assetsInlineLimit: 4096,
//启用/禁用 CSS 代码拆分
cssCodeSplit: true,
//构建后是否生成 source map 文件
sourcemap: false,
//自定义底层的 Rollup 打包配置
rollupOptions: {
output:{
chunkFileNames:'static/[name].[hash].js',
entryFileNames:"static/[name].[hash].js",
assetFileNames:"static/[name].[hash].[ext]"
}
},
//默认情况下,若 outDir 在 root 目录下,则 Vite 会在构建时清空该目录。
emptyOutDir: true,
//chunk 大小警告的限制
chunkSizeWarningLimit: 500
}
})