Files
autoAiWorkSys/app/vite.config.js
张成 e17d5610f5 1
2025-12-22 16:26:59 +08:00

50 lines
1.1 KiB
JavaScript
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
import { defineConfig } from 'vite';
import vue from '@vitejs/plugin-vue';
import { resolve, dirname } from 'path';
import { fileURLToPath } from 'url';
const __filename = fileURLToPath(import.meta.url);
const __dirname = dirname(__filename);
let base = './'
if (process.env.NODE_ENV === 'production') {
base = './app'
}
export default defineConfig({
plugins: [vue()],
root: resolve(__dirname, '.'),
base: base,
css: {
preprocessorOptions: {
less: {
javascriptEnabled: true
}
}
},
build: {
outDir: resolve(__dirname, './dist'),
emptyOutDir: true,
rollupOptions: {
input: resolve(__dirname, 'index.html')
},
assetsDir: 'assets',
chunkSizeWarningLimit: 1000,
// 对于 Electron需要确保模块能正确加载
modulePreload: false, // 禁用 module preload避免 file:// 协议问题
commonjsOptions: {
include: []
}
},
server: {
port: 3000,
strictPort: true
},
resolve: {
alias: {
'@': resolve(__dirname, '.')
},
extensions: ['.js', '.vue', '.json']
}
});