From 8383054ecf1cf92a4fed2f5fc03594bc551e936a Mon Sep 17 00:00:00 2001 From: Kara Brightwell Date: Wed, 31 Jul 2024 11:46:47 +0100 Subject: [PATCH] only include isomorphic-fetch if the application has explicitly disabled native fetch this will allow us to gradually enable native fetch in apps without a breaking change. --- main.js | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/main.js b/main.js index ed8e27bd..6bd46021 100644 --- a/main.js +++ b/main.js @@ -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');