|
@@ -5,6 +5,7 @@ import WindiCss from 'vite-plugin-windicss';
|
|
|
import AutoImport from 'unplugin-auto-import/vite'
|
|
|
import Components from 'unplugin-vue-components/vite'
|
|
|
import { ElementPlusResolver } from 'unplugin-vue-components/resolvers'
|
|
|
+import ConditionalCompile from './plugins/vite-plugin-conditional-compile'
|
|
|
|
|
|
// https://vitejs.dev/config/
|
|
|
export default defineConfig(({ command }) => {
|
|
@@ -12,7 +13,7 @@ export default defineConfig(({ command }) => {
|
|
|
const config: UserConfigExport = {
|
|
|
// base:'/app/xdjx/',
|
|
|
// base: '/app/xdjy/',
|
|
|
- base: '/app/xdhq/',
|
|
|
+ // base: '/app/xdhq/',
|
|
|
resolve: {
|
|
|
alias: {
|
|
|
'~': `${path.resolve(__dirname, 'src')}`,
|
|
@@ -29,6 +30,7 @@ export default defineConfig(({ command }) => {
|
|
|
},
|
|
|
},
|
|
|
plugins: [
|
|
|
+ ConditionalCompile(),
|
|
|
vue(),
|
|
|
WindiCss(),
|
|
|
AutoImport({
|
|
@@ -54,13 +56,23 @@ export default defineConfig(({ command }) => {
|
|
|
|
|
|
}
|
|
|
|
|
|
- if (command === 'serve') {
|
|
|
- config.base = "/"
|
|
|
- } else {
|
|
|
-
|
|
|
+ switch (command as string) {
|
|
|
+ case 'build:xdhq':
|
|
|
+ config.base = '/app/xdhq/'
|
|
|
+ break;
|
|
|
+ case 'build:xdjy':
|
|
|
+ config.base = '/app/xdjy/'
|
|
|
+ break;
|
|
|
+ case 'build:xdjx':
|
|
|
+ config.base = '/app/xdjx/'
|
|
|
+ break;
|
|
|
+ case 'serve':
|
|
|
+ config.base = '/'
|
|
|
+ break;
|
|
|
}
|
|
|
|
|
|
-
|
|
|
+ console.log('config.base :>> ', config.base);
|
|
|
+ // console.log('config.env :>> ', config.env);
|
|
|
return config
|
|
|
}
|
|
|
|