Bundling Your Node.js Express App with esbuild

Adam Berg
3 min readNov 2, 2021

When setting up a backend node project, I have almost always defaulted to setting up a TypeScript to build the app using the outDir property in tsconfig.json.

// tsconfig.json
{
"compilerOptions": {
...
"outDir": "./built",
...
}
}

This worked well for local development as the node_modules folder sits right there and running the built file is a simple node built/index.js.

This did not work so well when it came time to deploy the backend code to a server. In order to successfully run…

--

--

Adam Berg

Building https://kaizen.place. writing about C, C++, rust, game development, web development, engineering management. https://devtails.xyz/