ruoyi-plus-soybean/vite.config.ts

39 lines
907 B
TypeScript
Raw Normal View History

2022-04-27 19:01:54 +08:00
import { fileURLToPath } from 'url';
import { defineConfig, loadEnv } from 'vite';
2022-04-27 19:01:54 +08:00
import { viteDefine, setupVitePlugins, createViteProxy } from './build';
export default defineConfig(configEnv => {
const viteEnv = loadEnv(configEnv.mode, process.cwd()) as ImportMetaEnv;
2022-04-27 19:01:54 +08:00
const rootPath = fileURLToPath(new URL('./', import.meta.url));
const srcPath = `${rootPath}src`;
2022-03-12 19:32:15 +08:00
return {
base: viteEnv.VITE_BASE_URL,
resolve: {
alias: {
2022-04-27 19:01:54 +08:00
'~': rootPath,
'@': srcPath
}
},
define: viteDefine,
2022-04-27 19:01:54 +08:00
plugins: setupVitePlugins(viteEnv, srcPath),
css: {
preprocessorOptions: {
scss: {
additionalData: `@use "./src/styles/scss/global.scss" as *;`
}
}
},
server: {
2021-11-29 10:57:29 +08:00
host: '0.0.0.0',
port: 3200,
open: true,
proxy: createViteProxy(viteEnv)
},
build: {
brotliSize: false
}
};
});