diff --git a/src/core/config/resolvers/fetch.ts b/src/core/config/resolvers/fetch.ts index ad2bbc5e59..b412cca0a3 100644 --- a/src/core/config/resolvers/fetch.ts +++ b/src/core/config/resolvers/fetch.ts @@ -1,21 +1,11 @@ import consola from "consola"; import type { NitroOptions } from "nitro/types"; -import { nodeMajorVersion, provider } from "std-env"; export async function resolveFetchOptions(options: NitroOptions) { - if (options.experimental.nodeFetchCompat === undefined) { - options.experimental.nodeFetchCompat = (nodeMajorVersion || 0) < 18; - if (options.experimental.nodeFetchCompat && provider !== "stackblitz") { - consola.warn( - "Node fetch compatibility is enabled. Please consider upgrading to Node.js >= 18." - ); - } - } - if (!options.experimental.nodeFetchCompat) { - options.alias = { - "node-fetch-native/polyfill": "unenv/runtime/mock/empty", - "node-fetch-native": "node-fetch-native/native", - ...options.alias, - }; - } + // Use native fetch in builds + options.alias = { + "node-fetch-native/polyfill": "unenv/runtime/mock/empty", + "node-fetch-native": "node-fetch-native/native", + ...options.alias, + }; } diff --git a/src/types/config.ts b/src/types/config.ts index 7a9d8dc4ab..814e0c6096 100644 --- a/src/types/config.ts +++ b/src/types/config.ts @@ -116,10 +116,6 @@ export interface NitroOptions extends PresetOptions { * Disable Experimental Sourcemap Minification */ sourcemapMinify?: false; - /** - * Backward compatibility support for Node fetch (required for Node < 18) - */ - nodeFetchCompat?: boolean; /** * Allow env expansion in runtime config *