-
Notifications
You must be signed in to change notification settings - Fork 3
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
only include isomorphic-fetch if the application has explicitly disabled native fetch #838
base: main
Are you sure you want to change the base?
Conversation
…led native fetch this will allow us to gradually enable native fetch in apps without a breaking change.
8383054
to
a80344f
Compare
process.allowedNodeEnvironmentFlags.has('--no-experimental-fetch') && | ||
process.execArgv.includes('--no-experimental-fetch') |
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.
nitpick: not that we support said versions anymore, but process.allowedNodeEnvironmentFlags.has('--no-experimental-fetch')
resolving to false
implies that this is an older Node version without support for native fetch so we should fallback to isomorphic-fetch
in that case
process.allowedNodeEnvironmentFlags.has('--no-experimental-fetch') && | |
process.execArgv.includes('--no-experimental-fetch') | |
!process.allowedNodeEnvironmentFlags.has('--no-experimental-fetch') || | |
process.execArgv.includes('--no-experimental-fetch') |
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.
oh very good point
@@ -6,7 +6,13 @@ | |||
* @typedef {import("./typings/metrics").TickingMetric} TickingMetric | |||
*/ | |||
|
|||
require('isomorphic-fetch'); | |||
// only include isomorphic-fetch if the application has explicitly disabled native fetch |
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.
suggestion: could we expand this comment to add a bit of context on why we're doing this? afaict it's to satisfy problem hub as there won't be any behavioural change (as isomorphic-fetch
already checks if native fetch is present)
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.
so this idea is from Jen's original native fetch investigation. which i should have read a bit closer, because the reason she's suggesting doing it this way is so we can add a warning here. i'll do that. maybe?
message: | ||
"The 'withAb' option is deprecated and no longer supported by n-express or n-flags-client" |
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.
This looks like prettier or something edited an unrelated bit of code. The config seems wrong because ESLint is complaining about double quotes.
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.
bike shedding territory:
- i think it's fine to include a prettier change in an unrelated commit, nbd imo
- eslint is wrong in this case, prettier chooses double quotes here because it's more readable and eslint shouldn't be complaining about that. should probably be using the eslint prettier plugin to avoid these conflicts.
this will allow us to gradually enable native fetch in apps without a breaking change. by default, apps on Node 18 using Tool Kit set this flag. once everything has migrated to native fetch we can remove the dependency on
isomorphic-fetch
.