Description
emdash@0.37.0 cannot be built on Windows. The build fails before it starts, with an error that blames the Astro config:
[astro] Unable to load your Astro config
The argument 'filename' must be a file URL object, file URL string, or absolute path string.
Received 'file:///emdash-registry-verification.js'
The Astro config is not at fault. The root cause is in @emdash-cms/registry-verification@0.3.0, which emdash@0.37.0 inlines into its bundle. dist/index.js line 8 contains the rolldown CJS-interop shim:
var __require = /* @__PURE__ */ createRequire("file:///emdash-registry-verification.js");
That file URL has no drive letter. On macOS and Linux it resolves to the absolute path /emdash-registry-verification.js and createRequire() accepts it. On Windows there is no such thing as a driveless absolute path, so fileURLToPath() rejects it and createRequire() throws.
The call sits at module scope, so merely importing the package throws. In a normal EmDash site the import chain is astro.config → @emdash-cms/plugin-forms → emdash → the inlined registry-verification, which is why it surfaces as a config-loading failure.
emdash@0.36.0 is unaffected: grep 'createRequire("file:///' node_modules/emdash/dist/*.mjs returns nothing there. This is a regression introduced in 0.37.0.
Steps to reproduce
Minimal — no EmDash site needed. On Windows:
node -e "require('module').createRequire('file:///emdash-registry-verification.js')"
Throws. With a drive letter it works:
node -e "require('module').createRequire('file:///C:/x/emdash-registry-verification.js')"
Confirmed in the published tarball:
npm pack @emdash-cms/registry-verification@0.3.0
tar xzf emdash-cms-registry-verification-0.3.0.tgz
grep -n 'createRequire(' package/dist/index.js
8:var __require = /* @__PURE__ */ createRequire("file:///emdash-registry-verification.js");
__require itself is only used twice, inside lazily-evaluated CommonJS wrappers — line 2832 (require("crypto")) and line 5059 (require("util")) — but the createRequire() call that builds it is evaluated eagerly at module scope, so the lazy wrappers do not protect it.
In a real site:
- On Windows, take an EmDash site on Cloudflare (Astro 7,
@emdash-cms/cloudflare, @emdash-cms/plugin-forms).
- Upgrade
emdash and @emdash-cms/cloudflare to 0.37.0, and @emdash-cms/plugin-forms to 0.2.6.
npm install && npm run build
- The build fails with the error above. Downgrading to
0.36.0 / 0.2.5 restores a working build.
Suggested fix
dist/index.js is ESM (it opens with import { createRequire } from "node:module"), so import.meta.url is available and is the portable idiom:
var __require = /* @__PURE__ */ createRequire(import.meta.url);
Alternatively, configure the rolldown shim so it is given the real module URL rather than a synthetic file:///<name>.js placeholder.
Environment
- emdash version: 0.37.0 (0.36.0 works)
@emdash-cms/cloudflare: 0.37.0
@emdash-cms/plugin-forms: 0.2.6
@emdash-cms/registry-verification: 0.3.0 (transitive, inlined into emdash)
- Astro: 7.2.3
- Node.js: v24.15.0
- Runtime: Cloudflare Workers (build host is Windows)
- OS: Windows 11
Screenshots
Not applicable — this is a build-time failure, not an interface issue.
Logs / error output
> astro build
[astro] Unable to load your Astro config
The argument 'filename' must be a file URL object, file URL string, or absolute path string. Received 'file:///emdash-registry-verification.js'
Location:
node_modules/emdash/dist/api-Dz6rgoa3.mjs:3789:33
Stack trace:
at createRequire (node:internal/modules/cjs/loader:2039:13)
at ModuleJob.run (node:internal/modules/esm/module_job:437:25)
at async ModuleRunner.directRequest (node_modules/vite/dist/node/module-runner.js:1231:18)
at async eval (node_modules/@emdash-cms/plugin-forms/src/index.ts:7:31)
at async ModuleRunner.directRequest (node_modules/vite/dist/node/module-runner.js:1268:59)
The surrounding lines of the bundled chunk show which package it came from:
//#region ../registry-verification/dist/index.js
var __commonJSMin = (cb, mod) => () => (mod || cb((mod = { exports: {} }).exports, mod), mod.exports);
var __require = /* @__PURE__ */ createRequire("file:///emdash-registry-verification.js");
Description
emdash@0.37.0cannot be built on Windows. The build fails before it starts, with an error that blames the Astro config:The Astro config is not at fault. The root cause is in
@emdash-cms/registry-verification@0.3.0, whichemdash@0.37.0inlines into its bundle.dist/index.jsline 8 contains the rolldown CJS-interop shim:That file URL has no drive letter. On macOS and Linux it resolves to the absolute path
/emdash-registry-verification.jsandcreateRequire()accepts it. On Windows there is no such thing as a driveless absolute path, sofileURLToPath()rejects it andcreateRequire()throws.The call sits at module scope, so merely importing the package throws. In a normal EmDash site the import chain is
astro.config→@emdash-cms/plugin-forms→emdash→ the inlinedregistry-verification, which is why it surfaces as a config-loading failure.emdash@0.36.0is unaffected:grep 'createRequire("file:///' node_modules/emdash/dist/*.mjsreturns nothing there. This is a regression introduced in 0.37.0.Steps to reproduce
Minimal — no EmDash site needed. On Windows:
Throws. With a drive letter it works:
Confirmed in the published tarball:
__requireitself is only used twice, inside lazily-evaluated CommonJS wrappers — line 2832 (require("crypto")) and line 5059 (require("util")) — but thecreateRequire()call that builds it is evaluated eagerly at module scope, so the lazy wrappers do not protect it.In a real site:
@emdash-cms/cloudflare,@emdash-cms/plugin-forms).emdashand@emdash-cms/cloudflareto0.37.0, and@emdash-cms/plugin-formsto0.2.6.npm install && npm run build0.36.0/0.2.5restores a working build.Suggested fix
dist/index.jsis ESM (it opens withimport { createRequire } from "node:module"), soimport.meta.urlis available and is the portable idiom:Alternatively, configure the rolldown shim so it is given the real module URL rather than a synthetic
file:///<name>.jsplaceholder.Environment
@emdash-cms/cloudflare: 0.37.0@emdash-cms/plugin-forms: 0.2.6@emdash-cms/registry-verification: 0.3.0 (transitive, inlined intoemdash)Screenshots
Not applicable — this is a build-time failure, not an interface issue.
Logs / error output
The surrounding lines of the bundled chunk show which package it came from: