HOW BUILD TYPEORM TO PRODUCTION (TYPESCRIPT — JAVASCRIPT)?

José Carlos
Jun 1, 2021

I started using typeorm as my default Orm in the node js and surprised me.For me it’s the best !!

But a big question that arose was: How to build for production?

Assuming you already have an typeorm installed and configured ,we will first install dotenv.

Then you will create two .env documents

.env.dev file
.env.production file

You will also need to change ormconfig.js (if you have ormconfig.json switch to js) to detect what env variables use.

Finally create the following two scripts in package.json

And that’s it, just run yarn build or npm build and we already have the js code.

--

--