egoist / egoist/tsup

RollupError: "Writable" is not exported by "node:stream", imported by "src/foo.ts".

Open
#1,095 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

A really strange error...

`src/foo.ts` imports from Node internal:

```
import type { Writable } from 'node:stream'
```

tsup config:

```json
{
"clean": true,
"sourcemap": true,
"watch": false,
"silent": true,
"entry": [
"src/index.ts"
],
"dts": {
"resolve": true
},
"tsconfig": "tsconfig.build.json",
"outDir": "lib",
"format": [
"cjs",
"esm"
],
"shims": true,
"target": "node18.19.1"
}
```

Marking the `node:stream` package as external fixes the problem.

```json
"external": [
"node:stream"
],
```

Am I doing something wrong?

I have never had to add externals to the list in any other packages before.

Contributor guide

Open the contributing guide

Research direction

Reproduce the RollupError using the supplied tsup configuration, starting with the import in src/foo.ts. Then inspect the configured entry src/index.ts and tsconfig.build.json to determine why node:stream is being bundled; done means establishing the expected handling without relying on an unexplained manual external configuration.

Written by the indexing model from the issue text.

Assessment

Tech stack
node.js, rollup, typescript
Domain
build-system, tooling
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
30/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.