|
@@ -1,6 +1,6 @@
|
|
import { fileURLToPath, URL } from 'node:url'
|
|
import { fileURLToPath, URL } from 'node:url'
|
|
|
|
|
|
-import { defineConfig } from 'vite'
|
|
|
|
|
|
+import { defineConfig , loadEnv} from 'vite'
|
|
import vue from '@vitejs/plugin-vue'
|
|
import vue from '@vitejs/plugin-vue'
|
|
import VueDevTools from 'vite-plugin-vue-devtools'
|
|
import VueDevTools from 'vite-plugin-vue-devtools'
|
|
import VueSetupExtend from 'vite-plugin-vue-setup-extend'
|
|
import VueSetupExtend from 'vite-plugin-vue-setup-extend'
|
|
@@ -15,41 +15,49 @@ const createAutoImport = () => {
|
|
})
|
|
})
|
|
}
|
|
}
|
|
// https://vitejs.dev/config/
|
|
// https://vitejs.dev/config/
|
|
-export default defineConfig({
|
|
|
|
- plugins: [
|
|
|
|
- vue(),
|
|
|
|
- // VueDevTools(),
|
|
|
|
- VueSetupExtend(),
|
|
|
|
- createAutoImport(),
|
|
|
|
- AutoImport({
|
|
|
|
- resolvers: [VantResolver()]
|
|
|
|
- }),
|
|
|
|
- Components({
|
|
|
|
- resolvers: [VantResolver()]
|
|
|
|
- })
|
|
|
|
- ],
|
|
|
|
- resolve: {
|
|
|
|
- alias: {
|
|
|
|
- '@': fileURLToPath(new URL('./src', import.meta.url))
|
|
|
|
- }
|
|
|
|
- },
|
|
|
|
- server: {
|
|
|
|
- host: true,
|
|
|
|
- proxy: {
|
|
|
|
- '/dev-api': {
|
|
|
|
- target: 'http://172.16.10.61:8080',
|
|
|
|
- // target: 'https://vue.ruoyi.vip/prod-api',
|
|
|
|
- changeOrigin: true,
|
|
|
|
- rewrite: (p) => p.replace(/^\/dev-api/, '')
|
|
|
|
|
|
+export default defineConfig(({ mode }) => {
|
|
|
|
+ const env = loadEnv(mode, process.cwd());
|
|
|
|
+console.log(env)
|
|
|
|
+ return {
|
|
|
|
+ base: mode === 'development' ? '/' : '/web',
|
|
|
|
+ build: {
|
|
|
|
+ outDir: 'web'
|
|
|
|
+ },
|
|
|
|
+ plugins: [
|
|
|
|
+ vue(),
|
|
|
|
+ // VueDevTools(),
|
|
|
|
+ VueSetupExtend(),
|
|
|
|
+ createAutoImport(),
|
|
|
|
+ AutoImport({
|
|
|
|
+ resolvers: [VantResolver()]
|
|
|
|
+ }),
|
|
|
|
+ Components({
|
|
|
|
+ resolvers: [VantResolver()]
|
|
|
|
+ })
|
|
|
|
+ ],
|
|
|
|
+ resolve: {
|
|
|
|
+ alias: {
|
|
|
|
+ '@': fileURLToPath(new URL('./src', import.meta.url))
|
|
}
|
|
}
|
|
- }
|
|
|
|
- },
|
|
|
|
- //配置sass
|
|
|
|
- css: {
|
|
|
|
- preprocessorOptions: {
|
|
|
|
- scss: {
|
|
|
|
- additionalData:
|
|
|
|
- '@import "./src/assets/scss/globalVar.scss";@import "./src/assets/scss/globalMixin.scss";'
|
|
|
|
|
|
+ },
|
|
|
|
+ server: {
|
|
|
|
+ host: true,
|
|
|
|
+ proxy: {
|
|
|
|
+ '/dev-api': {
|
|
|
|
+ target: 'http://172.16.10.61:8080',
|
|
|
|
+ // target: 'https://vue.ruoyi.vip/prod-api',
|
|
|
|
+ changeOrigin: true,
|
|
|
|
+ rewrite: (p) => p.replace(/^\/dev-api/, '')
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ },
|
|
|
|
+ //配置sass
|
|
|
|
+ css: {
|
|
|
|
+ preprocessorOptions: {
|
|
|
|
+ scss: {
|
|
|
|
+ additionalData:
|
|
|
|
+ '@import "./src/assets/scss/globalVar.scss";@import "./src/assets/scss/globalMixin.scss";'
|
|
|
|
+ }
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|