unjs/giget

[bun] No matching export in "node_modules/node-fetch-native/dist/proxy.cjs"

Closed this issue ยท 6 comments

pi0 commented

Bun: 1.0.25

Git repo: https://github.com/tkjaergaard/giget-bun-reproduction

Steps to reproduce

  1. Clone repository
  2. Install Bun version 1.0.25 (https://bun.sh)
  3. Run bun install to install dependencies
  4. Run build command
$ bun build index.ts --outdir=dist --target=node

Error

11 | import { fetch } from 'node-fetch-native/proxy';
              ^
error: No matching export in "node_modules/node-fetch-native/dist/proxy.cjs" for import "fetch"
    at /Users/thomaskjaergaard/projects/internal/giget-bun-reproduction/node_modules/giget/dist/index.mjs:11:10

Originally posted by @tkjaergaard in #140 (comment)

If i set the build target to browser it works. But if i set it to bun or node i get the error.

When running the script using bun index.ts, i don't see the error either ๐Ÿค”

Also if i use import { fetch } from 'node-fetch-native/proxy' installed as a dependency i see the error.

Seems to more of an error with node-fetch-native/proxy than giget?

I've added an example of using node-fetch-native directly in the reproduction repo: fetch-native-proxy.ts

@pi0 any progress on this? ๐Ÿ˜Š

pi0 commented

Hi. It is definitely on my track. only 24h per day is not enough (notes) ๐Ÿ˜…

@pi0 All good, just interested in where this was stranded ๐Ÿ’ช

@pi0 I've identified the issue. It's related to unjs/node-fetch-native.

I've re-created the issue here: unjs/node-fetch-native#114.

@pi0 Think this should be closed since we fixed it in unjs/node-fetch-native#114 ๐Ÿ˜ŠโœŒ๏ธ