Skip to content

Create a single executable application using Node.js built-in feature

Given our shift to Node.js 20 and the current lack of support for Node.js 18 and 20 by pkg, we must explore an alternative approach to create a single executable application.

Node.js 20 has introduced a single executable application feature: https://nodejs.org/api/single-executable-applications.html

It's worth noting that, the single executable application feature currently does not support a virtual file system. In fact, it currently only supports running a single embedded script using the CommonJS module system. In other words, we cannot include "resources" into the single executable application.

In our case, this complicates things a bit because the Node.js test runner takes a list of files as an argument. One way to workaround this limitation would be to write the content of block-test.js and inline-test.js to temporary files before calling test.run().

We are also reading test cases from the tests directory but #11 (closed) will make it possible to load tests from a directory outside of the Node module.