egoist / egoist/tsup

`The argument 'filename' must be a file URL object, file URL string, or absolute path string. Received undefined`

Open
#1,352 1 comment 1 reaction 0 assignees View on GitHub
Dominant language
TypeScript
Stars
11.3k
Forks
275
PR merge metrics
No merged PRs in 30d

Description

Install `"@babel/traverse": "8.0.0-beta.1"`

Create `index.js`:

```js
import traverse from '@babel/traverse';
```

Then run:

```js
tsup index.js -d bundle
node bundle/index.js

node:internal/modules/cjs/loader:1895
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:1895:11)
at Object. (/Users/coderaiser/babel/bundle/1.js:35667:59)
at Module._compile (node:internal/modules/cjs/loader:1692:14)
at Object..js (node:internal/modules/cjs/loader:1824:10)
at Module.load (node:internal/modules/cjs/loader:1427:32)
at Module._load (node:internal/modules/cjs/loader:1250:12)
at TracingChannel.traceSync (node:diagnostics_channel:322:14)
at wrapModuleLoad (node:internal/modules/cjs/loader:235:24)
at Module.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:152:5)
at node:internal/main/run_main_module:33:47 {
code: 'ERR_INVALID_ARG_VALUE'
}

Node.js v24.3.0
```

The problem with:

```js
var globalsBuiltinLower = (0, import_module.createRequire)(import_meta.url)("@babel/helper-globals/data/builtin-lower.json");
var globalsBuiltinUpper = (0, import_module.createRequire)(import_meta.url)("@babel/helper-globals/data/builtin-upper.json");
```

Contributor guide

Open the contributing guide

Research direction

Reproduce the report with @babel/traverse 8.0.0-beta.1, index.js, and the shown tsup commands on Node.js 24.3.0. Inspect the generated bundle/index.js around the @babel/helper-globals/data/builtin-lower.json and builtin-upper.json imports, then verify that running the bundle no longer raises ERR_INVALID_ARG_VALUE for filename.

Written by the indexing model from the issue text.

Assessment

Tech stack
babel, node.js, typescript
Domain
build-system
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
42/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.