-
Notifications
You must be signed in to change notification settings - Fork 22
/
Copy pathvite.config.ts
55 lines (53 loc) · 1.52 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
import { defineConfig } from "vite"
import { resolve, extname } from "path"
import vue from "@vitejs/plugin-vue"
import { viteBuildManifest } from "./script/build-manifest"
import ViteComponents from "unplugin-vue-components/vite"
import { AntDesignVueResolver } from "unplugin-vue-components/resolvers"
import VueI18nPlugin from "@intlify/unplugin-vue-i18n/vite"
import manifest from "./manifest.config"
export default defineConfig(({ mode }) => {
const isDevMode = mode === "development"
return {
envPrefix: ["APP_", "npm_package_name", "npm_package_version"],
resolve: {
alias: {
"@": resolve(__dirname, "src")
}
},
build: {
minify: !isDevMode,
sourcemap: isDevMode,
chunkSizeWarningLimit: 1024,
rollupOptions: {
output: {
manualChunks: {
"ant-design": ["ant-design-vue", "@ant-design/icons-vue"]
},
chunkFileNames: "js/[name]-[hash].js",
entryFileNames: "js/[name]-[hash].js",
assetFileNames: info =>
extname(info.name!) === ".css"
? "css/[name]-[hash][extname]"
: "assets/[name]-[hash][extname]"
}
}
},
plugins: [
vue(),
VueI18nPlugin({
include: resolve(__dirname, "src/locales/**"),
compositionOnly: true
}),
ViteComponents({
dts: true,
resolvers: [
AntDesignVueResolver({
importStyle: false
})
]
}),
viteBuildManifest(manifest)
]
}
})