tursodatabase / libsql-client-ts

TypeScript/JavaScript client API for libSQL
https://docs.turso.tech/sdk/ts/quickstart
MIT License
289 stars 37 forks source link

Incorrect imports for esm assets #50

Closed huozhi closed 1 year ago

huozhi commented 1 year ago

in isomorphic-fetch/node.mjs it's destruction fetch function from node-fetch to get other exports like Request

import fetch from "node-fetch";
const { Request, Response, Headers } = fetch;
export { fetch, Request, Response, Headers };

But new version of node-fetch is a esm module now which doesn't contain those exports on fetch function. Need to chanage to import/export destruction expression to get them

- import fetch from "node-fetch";
- const { Request, Response, Headers } = fetch;
- export { fetch, Request, Response, Headers };
+ export { default as fetch, Request, Response, Headers } from 'node-fetch'

Related issue on next.js: https://github.com/vercel/next.js/issues/51309

huozhi commented 1 year ago

Close this as it should be on isomorphic-ts side, re-post here