-
Notifications
You must be signed in to change notification settings - Fork 51
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
fix(ky-universal): server importing es bundle #121
Conversation
Codecov Report
@@ Coverage Diff @@
## dev #121 +/- ##
=======================================
Coverage 97.18% 97.18%
=======================================
Files 1 1
Lines 71 71
Branches 39 39
=======================================
Hits 69 69
Misses 2 2 Continue to review full report at Codecov.
|
Hi @privatenumber and thanks for pull-request 👍 There is a strategy called interopDefault which we can do something like this: const _interopDefault = (ex) => ex && (typeof ex === 'object') && 'default' in ex) ? ex['default'] : ex
const fetch = _interopDefault(require('node-fetch')) |
Updated |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks!
@privatenumber Would you please elaborate more? What's the error with latest change? |
@pi0 Updated my comment |
Co-authored-by: pooya parsa <[email protected]>
Thank you @pi0 🔥 |
Using
@nuxt/http
on Vercel via@nuxtjs/now-builder
and was getting the following error on the server-side:I added a
console.log(fetch);
(as you can see above) and it was importing the ESM version (node-fetch/lib/index.es.js
). I specified the specific CJS build explicitly.