node-config can't be an ESM module until it's an ESM module (typescript compatibility)

Author: jdmarshallCreated Feb 24, 2026Updated Jul 10, 2026

If I attempt to set node-config to type: "module", then the typescript integration tests fail:

Error: Cannot parse config file: '/Users/jasonmarshall/Projects/cobbler/node-config/test/x-config-ts/default.ts': Error: Must use import to load ES Module: /Users/jasonmarshall/Projects/cobbler/node-config/test/x-config-ts/default.ts
require() of ES modules is not supported.
require() of /Users/jasonmarshall/Projects/cobbler/node-config/test/x-config-ts/default.ts from /Users/jasonmarshall/Projects/cobbler/node-config is an ES module file as it is a .ts file whose nearest parent package.json contains "type": "module" which defines all .ts files in that package scope as ES modules.
Instead change the requiring code to use import(), or remove "type": "module" from /Users/jasonmarshall/Projects/cobbler/node-config/package.json.

Essentially we need to import ts files if node-config is an ESM module, but that makes them async, which means parse() needs to be async. Which means people already need to be treating nodejs as an ESM module so that the top-level async that will work properly with their code importing node-config.

So we need to ship 5.0 in order to fix this. And then decide if fixing this bug constitutes a 6.0 version number or a 5.X version number. But I suspect the change in parse() constitutes a breaking change. I'll have to look at it more.