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 目录路径
|
// 动态解析 dist 目录路径
|
||||||
// 在 Vercel 环境中,__dirname 是 /var/task/api
|
// 在 Vercel 环境中,__dirname 是 /var/task/api
|
||||||
// dist 目录在 /var/task/dist
|
// NestJS 构建后文件在 dist/src 目录下
|
||||||
const distPath = path.resolve(__dirname, '..', 'dist', 'app.module');
|
const distPath = path.resolve(__dirname, '..', 'dist', 'src', 'app.module');
|
||||||
console.log('Loading AppModule from:', distPath);
|
console.log('Loading AppModule from:', distPath);
|
||||||
|
|
||||||
const { AppModule } = require(distPath);
|
const { AppModule } = require(distPath);
|
||||||
|
|
@ -48,6 +48,7 @@ async function bootstrap() {
|
||||||
__dirname,
|
__dirname,
|
||||||
'..',
|
'..',
|
||||||
'dist',
|
'dist',
|
||||||
|
'src',
|
||||||
'common',
|
'common',
|
||||||
'filters',
|
'filters',
|
||||||
'http-exception.filter',
|
'http-exception.filter',
|
||||||
|
|
@ -56,6 +57,7 @@ async function bootstrap() {
|
||||||
__dirname,
|
__dirname,
|
||||||
'..',
|
'..',
|
||||||
'dist',
|
'dist',
|
||||||
|
'src',
|
||||||
'common',
|
'common',
|
||||||
'interceptors',
|
'interceptors',
|
||||||
'transform.interceptor',
|
'transform.interceptor',
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,7 @@
|
||||||
{
|
{
|
||||||
"version": 2,
|
"version": 2,
|
||||||
|
"buildCommand": "pnpm install && pnpm run build",
|
||||||
|
"installCommand": "pnpm install",
|
||||||
"builds": [
|
"builds": [
|
||||||
{
|
{
|
||||||
"src": "api/index.ts",
|
"src": "api/index.ts",
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue