init
This commit is contained in:
@@ -0,0 +1,42 @@
|
||||
import { defineConfig, loadEnv, UserConfig } from 'vite';
|
||||
import vue from '@vitejs/plugin-vue';
|
||||
import path, { resolve } from 'path';
|
||||
|
||||
function pathResolve(dir) {
|
||||
// console.log(process.cwd());
|
||||
return resolve(process.cwd(), '.', dir);
|
||||
}
|
||||
|
||||
export default ({ mode }) => {
|
||||
return defineConfig({
|
||||
plugins: [vue()],
|
||||
resolve: {
|
||||
alias: {
|
||||
'@': path.resolve(__dirname, './src'),
|
||||
},
|
||||
},
|
||||
base: loadEnv(mode, process.cwd()).VITE_BASE_URL,
|
||||
// root: '',
|
||||
server: {
|
||||
host: '0.0.0.0',
|
||||
port: parseInt(loadEnv(mode, process.cwd()).VITE_PORT),
|
||||
open: true,
|
||||
proxy: {
|
||||
'/dev_api': {
|
||||
target: 'http://localhost:1024',
|
||||
changeOrigin: true,
|
||||
rewrite: (path) => path.replace(/^\/dev_api/, ''),
|
||||
},
|
||||
},
|
||||
},
|
||||
// optimizeDeps: {
|
||||
// include: ['@babel/runtime/regenerator'],
|
||||
// },
|
||||
build: {
|
||||
target: 'es2015',
|
||||
// outDir: "../docs",
|
||||
// emptyOutDir: true,
|
||||
cacheDir: 'node_modules/.vite_cache', // 配置缓存目录
|
||||
},
|
||||
});
|
||||
};
|
||||
Reference in New Issue
Block a user