Fix ESM build #83
Loading…
Reference in a new issue
No description provided.
Delete branch "fix-esm-build"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
A gotcha that we need to be mindful of in the future. Whenever we use these built-in Node.js libs we need to import the
node:*
variants lest we get bitten by therequire(...)
thing.I don't quite know what "the require(...) thing." is. Or I did and forgot, probably that.
I take it this slipped through locally but was an issue when deployed? Is there some way to catch it locally or CI?
@colemickens Basically when you're running in Node.js you need to import the
node:*
versions of core libraries.node:path
, for example, is basically a wrapper aroundpath
that looks like this:This turns an ordinary lib into a module that can be, in turn, compiled into an ESM module. If you don't have this wrapper and you just declare, say,
import { join } from "path"
then things crap out at runtime for reasons I admittedly do not fully understand.Reverted in https://github.com/DeterminateSystems/nix-installer-action/pull/86 because namespace runners were failing with:
(https://github.com/DeterminateSystems/magic-nix-cache/actions/runs/9102189543/job/25021651676)