File tree Expand file tree Collapse file tree 3 files changed +12
-4
lines changed Expand file tree Collapse file tree 3 files changed +12
-4
lines changed Original file line number Diff line number Diff line change 1
1
VITE_APP_PUBLIC_PATH = /
2
2
VITE_APP_PREVIEW = true
3
- VITE_APP_API_BASE_URL = /api
3
+ VITE_APP_API_BASE_URL = /api
4
+ VITE_APP_OUT_DIR = dist
Original file line number Diff line number Diff line change 1
1
import { dirname , resolve } from 'node:path'
2
2
import { fileURLToPath } from 'node:url'
3
+ import process from 'node:process'
3
4
import { unheadVueComposablesImports } from '@unhead/vue'
4
5
import legacy from '@vitejs/plugin-legacy'
5
6
import vue from '@vitejs/plugin-vue'
@@ -15,8 +16,11 @@ import Sitemap from 'vite-plugin-sitemap'
15
16
import VueDevTools from 'vite-plugin-vue-devtools'
16
17
import VueI18nPlugin from '@intlify/unplugin-vue-i18n/vite'
17
18
import { createViteVConsole } from './vconsole'
19
+ import { loadEnv } from 'vite'
20
+
21
+ export function createVitePlugins ( mode : string ) {
22
+ const env = loadEnv ( mode , process . cwd ( ) )
18
23
19
- export function createVitePlugins ( ) {
20
24
return [
21
25
// https://github.com/posva/unplugin-vue-router
22
26
VueRouter ( {
@@ -28,7 +32,9 @@ export function createVitePlugins() {
28
32
vue ( ) ,
29
33
30
34
// https://github.com/jbaubree/vite-plugin-sitemap
31
- Sitemap ( ) ,
35
+ Sitemap ( {
36
+ outDir : env . VITE_APP_OUT_DIR || 'dist' ,
37
+ } ) ,
32
38
33
39
// https://github.com/pengzhanbo/vite-plugin-mock-dev-server
34
40
mockDevServerPlugin ( ) ,
Original file line number Diff line number Diff line change @@ -13,7 +13,7 @@ export default ({ mode }: ConfigEnv): UserConfig => {
13
13
14
14
return {
15
15
base : env . VITE_APP_PUBLIC_PATH ,
16
- plugins : createVitePlugins ( ) ,
16
+ plugins : createVitePlugins ( mode ) ,
17
17
18
18
server : {
19
19
host : true ,
@@ -58,6 +58,7 @@ export default ({ mode }: ConfigEnv): UserConfig => {
58
58
build : {
59
59
cssCodeSplit : false ,
60
60
chunkSizeWarningLimit : 2048 ,
61
+ outDir : env . VITE_APP_OUT_DIR || 'dist' ,
61
62
} ,
62
63
63
64
optimizeDeps : { include, exclude } ,
You can’t perform that action at this time.
0 commit comments