-
Notifications
You must be signed in to change notification settings - Fork 200
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Webpack: isomorphic-unfetch breaks node build due to wrong esm interop. #122
Comments
I'm getting
With |
`isomorphic-unfetch` causes an error in the production server bundle because of an improper import on `node-fetch`, replacing it with `cross-fetch` fixes it. Ref: developit/unfetch#122
I had a similar issue to @ivan-kleshnin when using Slonik with Next.js in my project: https://github.com/karlhorky/next.js-with-slonik Fixed it in this commit by switching |
Awesome, thanks @danieltodonnell! |
I made a mistake and commented in the wrong issue :( I meant to write "we will investigate" in the issue in faunadb that was affected by this issue. |
Account for node-fetch exporting default. Fixes #122
Released in 4.2.0. Sorry for the super long wait! |
`isomorphic-unfetch` causes an error in the production server bundle because of an improper import on `node-fetch`, replacing it with `cross-fetch` fixes it. Ref: developit/unfetch#122
Bug Report
Requiring
isomorphic-unfetch
in a project built with Webpack targeting node leads to broken code. The issue is due to wrong interoperation between cjs & esm byisomorphic-unfetch
.How to Reproduce
Expected Result
Actual Result
Context
In file
packages/isomorphic-unfetch/index.js
, you can find the following code:require('node-fetch')
. However, the packagenode-fetch
exposes the functionfetch
as the default export in an ESM module [1]. The correct way of requiring a default export from CommonJS isrequire('node-fetch').default
; see [2].[1] https://github.com/bitinn/node-fetch/blob/master/src/index.js#L34
[2] node-fetch/node-fetch#450 (comment)
Environment
The text was updated successfully, but these errors were encountered: