Latest in Builds and Pipelines

HomeBuilds and Pipelines

Build tooling and CI/CD in practice: bundlers, transpilers, and the pipelines that turn source into shippable artifacts.

Run your Node.js app on Apple's container (a Docker Desktop alternative)

Apple shipped container 1.0 — an open-source, native CLI that runs Linux containers on macOS by giving each one its own lightweight micro-VM. It speaks OCI images and has a Docker-like CLI. Here's a real Node.js app built and run on it, the networking model, x86 images via Rosetta, and the gotchas — all verified on container 1.0.0 on an Apple-silicon Mac.

Node.js Docker images: full vs slim vs alpine vs distroless

Which base image should a Node.js app use? The choice swings your image from ~1.8 GB down to ~210 MB and changes how you debug and secure it. Here are the real sizes for the same app on node:26, node:26-slim, node:26-alpine, and distroless — all measured with Docker — plus the tradeoffs that actually matter.

Ship a Node.js app as a single executable binary

Node.js can bundle your script and the runtime into one executable file — a Single Executable Application — so users run your CLI without installing Node at all. Here's the full build, an embedded asset, and proof the binary runs on a machine with no Node installed. Verified on real Docker images.

The built-in Node.js test runner: a complete guide

You no longer need Jest, Mocha, or Vitest to test a Node.js project. node:test ships a complete runner — suites, hooks, mocking, filtering, watch mode, and coverage — that you run with node --test. No dependencies, no config. Every command and its output here is from a real node:26-slim Docker image.

Running TypeScript natively in Node.js: 22 vs 24 vs 26

Node.js runs .ts files directly — no ts-node, no tsx, no build step. But the details differ between Node 22, 24, and 26: what's flagged, what's stable, and one feature that was removed in Node 26. Every example here was run on real node:22-slim, node:24-slim, and node:26-slim Docker images.

Node.js features that replace popular npm packages

Node.js has quietly absorbed the jobs that used to need dependencies: a test runner, a file watcher, a .env loader, native TypeScript, fetch, terminal colors, deep clone, even SQLite. Here's what you can drop on Node.js 26 — every example verified on a real node:26 Docker image.

How to resize all JPGs in a folder to PNGs with a maximum width using FFmpeg?

FFmpeg is not only for converting videos, you know? I'll go straight to the point, here's how I use it.
This one command will get all JPGs in a folder, convert to PNGs and downscale it if it's more than 512px width:
for i in *.jpg; do ffmpeg -y -i "$i" -vf "scale='min(512,iw)':-1" -sws_flags bilinear "${i%.*}.png"; done 

How to convert all SVGs in a folder to PNG with Docker image?

I recently stumbled across this simple problem and realized, that I actually don't want to install any app like Inkscape just to do that. Came across this nice and simple docker image https://hub.docker.com/r/burke/svg2png.
Here's how I used it. First, I tried to run it against a single file to see if that works at all:
 docker run --rm -v `pwd`:/svg burke/svg2png "Logo.svg" -w 256
Surely enough, it...

Next.js ChunkLoadError: Loading chunk failed after deploying.

Everything was working fine locally, but the whole console gets red with ChunkLoadError after you deploy to production. Moreover, the frontend becomes blank white and you see Application error: a client-side exception has occurred (see the browser console for more information). The issue seems to be here for a while, and it looks like no-one knows which part exactly is responsible for the error (Next.js or Webpack or both), but the workaround is present.
Here are the steps that helped in my situation:
Your TypeScript project can't find expo/tsconfig.base, although you are sure it is there (besides, the project works just fine). Here's the fix.
You probably use VS Code, am I right? Then, restart your IDE. Yes, simple as that...

Storybook not building due to string-width ES Module dependency error.

You upgraded or just installed the latest Storybook 7 and now you can't build the project. No matter which Node version, NPM, Yarn, whatever other modules you have.
Error [ERR_REQUIRE_ESM]: require() of ES Module /x/node_modules/string-width/index.js from /x/node_modules/cli-table3/src/utils.js not supported. Instead change the require of index.js in /x/node_modules/cli-table3/src/utils.js to a dynamic import() which is available in all CommonJS modules. at Object.<anonymous> (/x/node_modules/cli-table3/src/utils.js:1:21) at Object.<anonymous> (/x/node_modules/cli-table3/src/table.js:2:15) at Object.<anonymous> (/x/node_modules/cli-table3/index.js:1:18) at Object.<anonymous> (/x/node_modules/@storybook/core-server/dist/index.js:113:7858) at Object.<anonymous> (/x/node_modules/@storybook/cli/dist/generate.js:11:4494) at Object.<anonymous> (/x/node_modules/@storybook/cli/bin/index.js:9:1) at Object.<anonymous> (/x/node_modules/storybook/index.js:3:1) { code:...

[!] RollupError: Node tried to load your configuration as an ES module even though it is likely CommonJS. To resolve this, change the extension of your configuration to ".cjs" or pass the "--bundleConfigAsCjs" flag.

Sounds familiar?
It took me a while to figure out that the actual error is written lower:
Original error: module is not defined in ES module scope.
What this means is there's no variable named module in the rollup.config.mjs file.
To fix that, you just need to replace CommonJS export to ES export, which means your module.exports = { should become export...

About Code with Node.js

This is a personal blog and reference point of a Node.js developer.

I write and explain how different Node and JavaScript aspects work, as well as research popular and cool packages, and of course fail time to time.