-
Notifications
You must be signed in to change notification settings - Fork 127
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: fix exports for node #205
Conversation
Codecov Report
@@ Coverage Diff @@
## main #205 +/- ##
=======================================
Coverage 85.75% 85.75%
=======================================
Files 5 5
Lines 323 323
Branches 59 59
=======================================
Hits 277 277
Misses 46 46 Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here. |
exports.ofetch.create = defaultOptions => getExport("ofetch").then($fetch => $fetch.create(defaultOptions)); | ||
exports.ofetch.raw = (input, init) => getExport("ofetch").then($fetch => $fetch.raw(input, init)); | ||
exports.ofetch.native = (input, init) => getExport("ofetch").then($fetch => $fetch.native(input, init)); | ||
|
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.
Since ofetch
is actually $fetch
, I added these exports.
Line 20 in 5943c5f
export const $fetch = ofetch; |
exports.ofetch = createCaller("ofetch"); | ||
exports.ofetch.create = defaultOptions => getExport("ofetch").then($fetch => $fetch.create(defaultOptions)); |
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.
We need to return a sync version of fetch that itself has raw/native/etc
Thanks for the PR dear @nozomuikuta. Since issues with CJS support is now resolved using node-fetch-native with CJS support, i'm thinking to completely drop this stub. |
Oh, I see then let me close this PR. 🙆♂️ |
~> #211 |
Great work! fixed the issue for me, thanks. |
Resolves #198
I tested this PR in the following way:
node_modules
as this PRrequire('ofetch')
(fromexports["."]["node"]["require"]
inpackage.json
require('ofetch')
(fromexports["default"]["require"]
inpackage.json
(with.
subpath deleted in the file for fallback to work)require('ofetch/node')
(fromexports["./node"]["require"]
inpackage.json