-
-
Notifications
You must be signed in to change notification settings - Fork 41
Description
Problem
pkgroll
2.8.2
worked fine, but since 2.10.0
, and still on 2.11.0
; we're seeing the following error:
- Bump pkgroll from 2.8.2 to 2.10.0 jehna/humanify#322 (comment)
- Bump pkgroll from 2.8.2 to 2.11.0 jehna/humanify#343 (comment)
node:internal/modules/cjs/loader:1631
throw new ERR_INVALID_ARG_VALUE('filename', filename, createRequireError);
^
TypeError [ERR_INVALID_ARG_VALUE]: The argument 'filename' must be a file URL object, file URL string, or absolute path string. Received undefined
at createRequire (node:internal/modules/cjs/loader:1631:11)
at file:///Users/runner/work/humanify/humanify/dist/index.mjs:137[4](https://github.com/jehna/humanify/actions/runs/13489863907/job/37686273739?pr=343#step:7:5):18 {
code: 'ERR_INVALID_ARG_VALUE'
}
Node.js v20.18.1
node:internal/modules/cjs/loader:1762
throw new ERR_INVALID_ARG_VALUE('filename', filename, createRequireError);
^
TypeError [ERR_INVALID_ARG_VALUE]: The argument 'filename' must be a file URL object, file URL string, or absolute path string. Received undefined
at createRequire (node:internal/modules/cjs/loader:1762:11)
at file:///Users/devalias/dev/tmp/humanify/dist/index.mjs:1374:18 {
code: 'ERR_INVALID_ARG_VALUE'
}
Node.js v22.6.0
Looking at the code in
/Users/devalias/dev/tmp/humanify/dist/index.mjs:1374:18
:// ..snip.. /* 1373 */ const import_meta = {}; /* 1374 */ const require2 = createRequire(import_meta.url); /* 1375 */ const __filename = fileURLToPath(import_meta.url); /* 1376 */ dirname(__filename); /* 1377 */ var __create = Object.create; /* 1378 */ var __defProp2 = Object.defineProperty; /* 1379 */ var __getOwnPropDesc = Object.getOwnPropertyDescriptor; /* 1380 */ var __getOwnPropNames = Object.getOwnPropertyNames; /* 1381 */ var __getProtoOf = Object.getPrototypeOf; /* 1382 */ var __hasOwnProp2 = Object.prototype.hasOwnProperty; // ..snip..So it seems the error is because
import_meta.url
isundefined
.Originally posted by @0xdevalias in jehna/humanify#343 (comment)
Looking at
/Users/devalias/dev/tmp/humanify/node_modules/prettier/index.mjs
, we can more or less match up those lines:import { createRequire as __prettierCreateRequire } from "module"; import { fileURLToPath as __prettierFileUrlToPath } from "url"; import { dirname as __prettierDirname } from "path"; const require = __prettierCreateRequire(import.meta.url); const __filename = __prettierFileUrlToPath(import.meta.url); const __dirname = __prettierDirname(__filename); var __create = Object.create; var __defProp = Object.defineProperty; var __getOwnPropDesc = Object.getOwnPropertyDescriptor; var __getOwnPropNames = Object.getOwnPropertyNames; var __getProtoOf = Object.getPrototypeOf; var __hasOwnProp = Object.prototype.hasOwnProperty;But we can see that
import.meta.url
is left as-is in theprettier
.mjs
; whereas it's being transpiled in our version for some reason.Originally posted by @0xdevalias in jehna/humanify#343 (comment)
See also:
Expected behavior
The build would continue to work correctly as it did before, and not get any runtime errors.
Minimal reproduction URL
https://github.com/0xdevalias/min-repro-pkgroll-2-10-0-regression
Version
2.10.0, 2.11.0
Node.js version
20.18.1, 22.6.0
Package manager
npm
Operating system
macOS
Bugs are expected to be fixed by those affected by it
- I'm interested in working on this issue
Compensating engineering work financially will speed up resolution
- I'm willing to offer financial support