in the file of app.module.ts, I used Environment variable
imports: [
ConfigModule.forRoot({ envFilePath: [`./src/config/${process.env.NODE_ENV}.env`], isGlobal: true },),
MongooseModule.forRoot(process.env.DATABASE_URL, {
useNewUrlParser: true,
user: `${process.env.DATABASE_USER}`,
pass: `${process.env.DATABASE_PASSWD}`,
}),
It was working when I test in local,But when I build it,The env is not work,So what can I do ,Thinks
my package.json script
"build": "NODE_ENV=prod nest build", // the env not work
"start:dev": "NODE_ENV=dev nest start --watch", // it works