|
|
@@ -1,7 +1,7 @@
|
|
|
import { fileURLToPath, URL } from 'node:url'
|
|
|
import path from 'path'
|
|
|
|
|
|
-import { defineConfig } from 'vite'
|
|
|
+import { defineConfig, loadEnv } from 'vite'
|
|
|
import vue from '@vitejs/plugin-vue'
|
|
|
import vueJsx from '@vitejs/plugin-vue-jsx'
|
|
|
import AutoImport from 'unplugin-auto-import/vite'
|
|
|
@@ -10,38 +10,40 @@ import DefineOptions from 'unplugin-vue-define-options/vite'
|
|
|
import { createSvgIconsPlugin } from 'vite-plugin-svg-icons'
|
|
|
import Unocss from 'unocss/vite'
|
|
|
|
|
|
-// https://vitejs.dev/config/
|
|
|
-export default defineConfig({
|
|
|
- plugins: [
|
|
|
- vue(),
|
|
|
- vueJsx(),
|
|
|
- Unocss(),
|
|
|
- DefineOptions(),
|
|
|
- AutoImport({
|
|
|
- imports: ['vue', 'vue-router', 'pinia', '@vueuse/core'],
|
|
|
- dts: 'src/auto-import.d.ts'
|
|
|
- }),
|
|
|
- Components({
|
|
|
- dirs: ['src/components'],
|
|
|
- extensions: ['vue'],
|
|
|
- dts: 'src/components.d.ts'
|
|
|
- }),
|
|
|
- createSvgIconsPlugin({
|
|
|
- iconDirs: [path.resolve(process.cwd(), 'src/assets/svg')],
|
|
|
- symbolId: 'icon-[dir]-[name]'
|
|
|
- })
|
|
|
- ],
|
|
|
- resolve: {
|
|
|
- alias: {
|
|
|
- '@': fileURLToPath(new URL('./src', import.meta.url))
|
|
|
- }
|
|
|
- },
|
|
|
- server: {
|
|
|
- proxy: {
|
|
|
- '/apiSys': {
|
|
|
- // target: 'https://yunji.sxidc.com',
|
|
|
- target: 'http://10.0.0.33:8080/',
|
|
|
- changeOrigin: true
|
|
|
+export default defineConfig(({ mode }) => {
|
|
|
+ const env = loadEnv(mode, process.cwd(), '')
|
|
|
+ return {
|
|
|
+ plugins: [
|
|
|
+ vue(),
|
|
|
+ vueJsx(),
|
|
|
+ Unocss(),
|
|
|
+ DefineOptions(),
|
|
|
+ AutoImport({
|
|
|
+ imports: ['vue', 'vue-router', 'pinia', '@vueuse/core'],
|
|
|
+ dts: 'src/auto-import.d.ts'
|
|
|
+ }),
|
|
|
+ Components({
|
|
|
+ dirs: ['src/components'],
|
|
|
+ extensions: ['vue'],
|
|
|
+ dts: 'src/components.d.ts'
|
|
|
+ }),
|
|
|
+ createSvgIconsPlugin({
|
|
|
+ iconDirs: [path.resolve(process.cwd(), 'src/assets/svg')],
|
|
|
+ symbolId: 'icon-[dir]-[name]'
|
|
|
+ })
|
|
|
+ ],
|
|
|
+ resolve: {
|
|
|
+ alias: {
|
|
|
+ '@': fileURLToPath(new URL('./src', import.meta.url))
|
|
|
+ }
|
|
|
+ },
|
|
|
+ server: {
|
|
|
+ proxy: {
|
|
|
+ [env.VITE_BASE_API]: {
|
|
|
+ // target: 'https://yunji.sxidc.com',
|
|
|
+ target: env.VITE_BASE_PATH,
|
|
|
+ changeOrigin: true
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
}
|