When i deploy my nestjs server on render, it work well but when I deploy on vercel, I encountered some problem in runtime that come from import ? beside is my file with import and I attached image about error on vercel. Anyone can help me ?
import { hash } from 'bcryptjs';
import { Entity, Property, BeforeCreate, BeforeUpdate } from '@mikro-orm/core';
import { TABLE_NAME } from '@/common/constants';
import { BaseEntity } from '@/common/entity/base.entity';
@Entity({ tableName: TABLE_NAME.USER })
export class User extends BaseEntity {
@Property({ unique: true })
username!: string;
@Property({ hidden: true })
password!: string;
@BeforeCreate()
async hashPasswordBeforeCreate() {
this.password = await hash(this.password, 10);
}
@BeforeUpdate()
async hashPasswordBeforeUpdate() {
if (this.password && !this.password.startsWith('$2b$')) {
this.password = await hash(this.password, 10);
}
}
}
tsconfig.json
{
"compilerOptions": {
"module": "commonjs",
"declaration": true,
"removeComments": true,
"emitDecoratorMetadata": true,
"experimentalDecorators": true,
"allowSyntheticDefaultImports": true,
"target": "ES2023",
"sourceMap": true,
"outDir": "./dist",
"baseUrl": "./",
"incremental": true,
"skipLibCheck": true,
"strictNullChecks": true,
"forceConsistentCasingInFileNames": true,
"noImplicitAny": false,
"strictBindCallApply": false,
"noFallthroughCasesInSwitch": false,
"paths": {
"@/*": ["./src/*"]
}
}
}
src/common/constants/index.ts
export const TABLE_NAME = {
USER: 'user',
} as const;
tsconfig.build.json
{
"extends": "./tsconfig.json",
"exclude": ["node_modules", "test", "dist", "**/*spec.ts"]
}