egoist / egoist/tsup

tsup unnecessarily strips the `node:` prefix when building for cjs

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

Description

Calling `require("node:path")` was added in Node v14.18.0, but tsup adds the `nodeProtocolPlugin` to the list of esbuild plugins whenever building for `cjs`. I'd like to be able to build for cjs while targeting Node >= 14.18 and preserve the original `node:` require path. It also seems like this is unnecessary since esbuild handles this here:

https://github.com/evanw/esbuild/issues/1760

Contributor guide

Open the contributing guide

Research direction

Start by locating the nodeProtocolPlugin and the configuration that adds it for cjs builds. Compare that behavior with the linked esbuild issue and verify that a cjs build targeting Node >=14.18 preserves the original node: require path.

Written by the indexing model from the issue text.

Assessment

Tech stack
node.js, typescript
Domain
build-system, tooling
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 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.