Skip to content

Commit

Permalink
only include isomorphic-fetch if the application has explicitly disab…
Browse files Browse the repository at this point in the history
…led native fetch

this will allow us to gradually enable native fetch in apps without a breaking change.
  • Loading branch information
apaleslimghost authored Jul 31, 2024
1 parent fed34b2 commit 8383054
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion main.js
Original file line number Diff line number Diff line change
Expand Up @@ -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
if(
process.allowedNodeEnvironmentFlags.has('--no-experimental-fetch') &&
process.execArgv.includes('--no-experimental-fetch')
) {
require('isomorphic-fetch');
}

const fs = require('fs');
const path = require('path');
Expand Down

0 comments on commit 8383054

Please sign in to comment.