@@ -4,40 +4,44 @@ import { defineConfig, loadEnv } from 'vite'
44import vue from '@vitejs/plugin-vue'
55import vueJsx from '@vitejs/plugin-vue-jsx'
66import DefineOptions from 'unplugin-vue-define-options/vite'
7+ import path from 'path'
8+ import { createHtmlPlugin } from 'vite-plugin-html'
9+
710// import vueDevTools from 'vite-plugin-vue-devtools'
811const envDir = './env'
912
1013// https://vite.dev/config/
1114export default defineConfig ( ( { mode } ) => {
15+ console . log ( 'ssss' )
1216 const ENV = loadEnv ( mode , envDir )
1317 const prefix = process . env . VITE_DYNAMIC_PREFIX || ENV . VITE_BASE_PATH
1418 const proxyConf : Record < string , string | ProxyOptions > = { }
1519 proxyConf [ '/api' ] = {
1620 target : 'http://127.0.0.1:8080' ,
1721 changeOrigin : true ,
18- rewrite : ( path ) => path . replace ( ENV . VITE_BASE_PATH , '/' ) ,
22+ rewrite : ( path : string ) => path . replace ( ENV . VITE_BASE_PATH , '/' ) ,
1923 }
20- proxyConf [ '/oss' ] = {
24+ proxyConf [ '/oss' ] = {
2125 target : 'http://127.0.0.1:8080' ,
2226 changeOrigin : true ,
23- rewrite : ( path ) => path . replace ( ENV . VITE_BASE_PATH , '/' ) ,
27+ rewrite : ( path : string ) => path . replace ( ENV . VITE_BASE_PATH , '/' ) ,
2428 }
2529 proxyConf [ '/doc' ] = {
2630 target : 'http://127.0.0.1:8080' ,
2731 changeOrigin : true ,
28- rewrite : ( path ) => path . replace ( ENV . VITE_BASE_PATH , '/' ) ,
32+ rewrite : ( path : string ) => path . replace ( ENV . VITE_BASE_PATH , '/' ) ,
2933 }
3034 proxyConf [ '/static' ] = {
3135 target : 'http://127.0.0.1:8080' ,
3236 changeOrigin : true ,
33- rewrite : ( path ) => path . replace ( ENV . VITE_BASE_PATH , '/' ) ,
37+ rewrite : ( path : string ) => path . replace ( ENV . VITE_BASE_PATH , '/' ) ,
3438 }
3539 return {
3640 preflight : false ,
3741 lintOnSave : false ,
3842 base : prefix ,
3943 envDir : envDir ,
40- plugins : [ vue ( ) , vueJsx ( ) , DefineOptions ( ) ] ,
44+ plugins : [ vue ( ) , vueJsx ( ) , DefineOptions ( ) , createHtmlPlugin ( { template : ENV . VITE_INPUT } ) ] ,
4145 server : {
4246 cors : true ,
4347 host : '0.0.0.0' ,
@@ -46,7 +50,10 @@ export default defineConfig(({ mode }) => {
4650 proxy : proxyConf ,
4751 } ,
4852 build : {
49- outDir : 'dist/ui' ,
53+ outDir : `dist${ ENV . VITE_BASE_PATH } ` ,
54+ rollupOptions : {
55+ input : path . resolve ( __dirname , ENV . VITE_INPUT ) ,
56+ } ,
5057 } ,
5158 resolve : {
5259 alias : {
0 commit comments