2024-07-13 13:00:31 +00:00
|
|
|
import {
|
|
|
|
defaultImportmapOptions,
|
|
|
|
defineConfig,
|
|
|
|
getDefaultPwaOptions,
|
|
|
|
loadAndConvertEnv,
|
|
|
|
} from '@vben/vite-config';
|
2024-05-19 13:20:42 +00:00
|
|
|
|
2024-07-13 13:00:31 +00:00
|
|
|
export default defineConfig(async () => {
|
2024-07-28 06:29:05 +00:00
|
|
|
const { appTitle, base, port, ...envConfig } = await loadAndConvertEnv();
|
2024-07-13 13:00:31 +00:00
|
|
|
return {
|
|
|
|
application: {
|
2024-07-09 15:43:08 +00:00
|
|
|
...envConfig,
|
2024-06-16 07:45:15 +00:00
|
|
|
importmap: false,
|
2024-07-13 13:00:31 +00:00
|
|
|
importmapOptions: defaultImportmapOptions,
|
2024-06-16 07:45:15 +00:00
|
|
|
pwa: false,
|
2024-07-13 13:00:31 +00:00
|
|
|
pwaOptions: getDefaultPwaOptions(appTitle),
|
|
|
|
},
|
|
|
|
vite: {
|
2024-07-28 06:29:05 +00:00
|
|
|
base,
|
2024-07-13 13:00:31 +00:00
|
|
|
server: {
|
|
|
|
port,
|
|
|
|
proxy: {
|
|
|
|
'/api': {
|
|
|
|
changeOrigin: true,
|
|
|
|
rewrite: (path) => path.replace(/^\/api/, ''),
|
2024-07-28 06:29:05 +00:00
|
|
|
// mock代理目标地址
|
2024-07-13 13:00:31 +00:00
|
|
|
target: 'http://localhost:5320/api',
|
|
|
|
ws: true,
|
|
|
|
},
|
2024-05-19 13:20:42 +00:00
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
2024-07-13 13:00:31 +00:00
|
|
|
};
|
2024-05-19 13:20:42 +00:00
|
|
|
});
|