fix: 修正 NestJS 构建产物路径为 dist/src
- 修复模块加载路径:dist/app.module -> dist/src/app.module - 添加 Vercel 构建命令配置 - 确保 dist 目录在部署时被正确构建和包含 Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
parent
43ad64dd41
commit
a7c082a162
|
|
@ -15,8 +15,8 @@ async function bootstrap() {
|
|||
|
||||
// 动态解析 dist 目录路径
|
||||
// 在 Vercel 环境中,__dirname 是 /var/task/api
|
||||
// dist 目录在 /var/task/dist
|
||||
const distPath = path.resolve(__dirname, '..', 'dist', 'app.module');
|
||||
// NestJS 构建后文件在 dist/src 目录下
|
||||
const distPath = path.resolve(__dirname, '..', 'dist', 'src', 'app.module');
|
||||
console.log('Loading AppModule from:', distPath);
|
||||
|
||||
const { AppModule } = require(distPath);
|
||||
|
|
@ -48,6 +48,7 @@ async function bootstrap() {
|
|||
__dirname,
|
||||
'..',
|
||||
'dist',
|
||||
'src',
|
||||
'common',
|
||||
'filters',
|
||||
'http-exception.filter',
|
||||
|
|
@ -56,6 +57,7 @@ async function bootstrap() {
|
|||
__dirname,
|
||||
'..',
|
||||
'dist',
|
||||
'src',
|
||||
'common',
|
||||
'interceptors',
|
||||
'transform.interceptor',
|
||||
|
|
|
|||
|
|
@ -1,5 +1,7 @@
|
|||
{
|
||||
"version": 2,
|
||||
"buildCommand": "pnpm install && pnpm run build",
|
||||
"installCommand": "pnpm install",
|
||||
"builds": [
|
||||
{
|
||||
"src": "api/index.ts",
|
||||
|
|
|
|||
Loading…
Reference in New Issue