Skip to content

Commit

Permalink
Merge pull request #723 from Financial-Times/fix-native-fetch
Browse files Browse the repository at this point in the history
Fix native fetch
  • Loading branch information
apaleslimghost authored Dec 9, 2024
2 parents c84315e + edf6443 commit 8f9ad7e
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
5 changes: 1 addition & 4 deletions core/cli/src/fetch.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,5 @@ export const shouldDisableNativeFetch = (options: RootOptions): boolean => {
// disable Node 18's native fetch if the Node runtime supports it (older
// runtimes don't support the flag, implying they also don't use native
// fetch) and the user hasn't opted out of the behaviour
return (
options.allowNativeFetch &&
process.allowedNodeEnvironmentFlags.has('--no-experimental-fetch')
)
return !options.allowNativeFetch && process.allowedNodeEnvironmentFlags.has('--no-experimental-fetch')
}
5 changes: 4 additions & 1 deletion core/cli/src/tasks.ts
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,10 @@ export async function runTasksFromConfig(
await runInit(logger, config)
await checkInstall(logger, config)

if (shouldDisableNativeFetch(config.pluginOptions['app root'].options)) {
if (
shouldDisableNativeFetch(config.pluginOptions['app root'].options) &&
!process.execArgv.includes('--no-experimental-fetch')
) {
process.execArgv.push('--no-experimental-fetch')
}

Expand Down

0 comments on commit 8f9ad7e

Please sign in to comment.