49 lines
1.2 KiB
JavaScript
49 lines
1.2 KiB
JavaScript
import { resolve } from 'path';
|
||
|
||
// 可选的前端构建配置:不改变现有直出模式
|
||
// - 输入:根目录 index.html 与 admin/index.html
|
||
// - 输出:dist/ (与生产无关,默认不被服务端使用)
|
||
// - 可选使用:npm run dev:fe / build:fe / preview:fe
|
||
|
||
export default {
|
||
root: '.',
|
||
publicDir: 'public',
|
||
server: {
|
||
port: 5173,
|
||
open: false,
|
||
proxy: {
|
||
'/api': {
|
||
target: 'http://localhost:3456',
|
||
changeOrigin: true
|
||
},
|
||
'/pdfjs': {
|
||
target: 'http://localhost:3456',
|
||
changeOrigin: true
|
||
},
|
||
'/mineru': {
|
||
target: 'http://localhost:3456',
|
||
changeOrigin: true
|
||
},
|
||
'/doc2x': {
|
||
target: 'http://localhost:3456',
|
||
changeOrigin: true
|
||
}
|
||
}
|
||
},
|
||
// 排除 PDF.js 的依赖优化,避免模块转换问题
|
||
optimizeDeps: {
|
||
exclude: ['pdfjs-dist']
|
||
},
|
||
build: {
|
||
outDir: 'dist',
|
||
emptyOutDir: true,
|
||
rollupOptions: {
|
||
input: {
|
||
main: resolve(__dirname, 'index.html'),
|
||
// admin 入口已被 .vercelignore 排除,不参与 Vercel 构建
|
||
// admin: resolve(__dirname, 'admin/index.html'),
|
||
},
|
||
},
|
||
},
|
||
};
|