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 11VITE_APP_PUBLIC_PATH = /
22VITE_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 11import { dirname , resolve } from 'node:path'
22import { fileURLToPath } from 'node:url'
3+ import process from 'node:process'
34import { unheadVueComposablesImports } from '@unhead/vue'
45import legacy from '@vitejs/plugin-legacy'
56import vue from '@vitejs/plugin-vue'
@@ -15,8 +16,11 @@ import Sitemap from 'vite-plugin-sitemap'
1516import VueDevTools from 'vite-plugin-vue-devtools'
1617import VueI18nPlugin from '@intlify/unplugin-vue-i18n/vite'
1718import { createViteVConsole } from './vconsole'
19+ import { loadEnv } from 'vite'
20+
21+ export function createVitePlugins ( mode : string ) {
22+ const env = loadEnv ( mode , process . cwd ( ) )
1823
19- export function createVitePlugins ( ) {
2024 return [
2125 // https://github.com/posva/unplugin-vue-router
2226 VueRouter ( {
@@ -28,7 +32,9 @@ export function createVitePlugins() {
2832 vue ( ) ,
2933
3034 // https://github.com/jbaubree/vite-plugin-sitemap
31- Sitemap ( ) ,
35+ Sitemap ( {
36+ outDir : env . VITE_APP_OUT_DIR || 'dist' ,
37+ } ) ,
3238
3339 // https://github.com/pengzhanbo/vite-plugin-mock-dev-server
3440 mockDevServerPlugin ( ) ,
Original file line number Diff line number Diff line change @@ -13,7 +13,7 @@ export default ({ mode }: ConfigEnv): UserConfig => {
1313
1414 return {
1515 base : env . VITE_APP_PUBLIC_PATH ,
16- plugins : createVitePlugins ( ) ,
16+ plugins : createVitePlugins ( mode ) ,
1717
1818 server : {
1919 host : true ,
@@ -58,6 +58,7 @@ export default ({ mode }: ConfigEnv): UserConfig => {
5858 build : {
5959 cssCodeSplit : false ,
6060 chunkSizeWarningLimit : 2048 ,
61+ outDir : env . VITE_APP_OUT_DIR || 'dist' ,
6162 } ,
6263
6364 optimizeDeps : { include, exclude } ,
You can’t perform that action at this time.
0 commit comments