egoist / tsup

The simplest and fastest way to bundle your TypeScript libraries.

Home Page:https://tsup.egoist.dev

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

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

moltar opened this issue · comments

A really strange error...

src/foo.ts imports from Node internal:

import type { Writable } from 'node:stream'

tsup config:

{
  "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.

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

Am I doing something wrong?

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

Upvote & Fund

  • We're using Polar.sh so you can upvote and help fund this issue.
  • We receive the funding once the issue is completed & confirmed by you.
  • Thank you in advance for helping prioritize & fund our backlog.
Fund with Polar