Skip to content

Commit

Permalink
fixup! fix(metro-service): lazy-load node-fetch to avoid punycode
Browse files Browse the repository at this point in the history
… warning
  • Loading branch information
tido64 committed Jan 27, 2025
1 parent ea8ca79 commit 9c87399
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions packages/metro-service/src/server.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { requireModuleFromMetro } from "@rnx-kit/tools-react-native/metro";
import type { runServer } from "metro";
import net from "net";
import net from "node:net";
import { ensureBabelConfig } from "./babel";

type ServerStatus = "not_running" | "already_running" | "in_use" | "unknown";
Expand All @@ -12,7 +12,8 @@ function getFetchImpl(): (url: string | URL) => Promise<Response> {

// TODO: Remove `node-fetch` when we drop support for Node 16
// @ts-expect-error To be removed when Node 16 is no longer supported
return (...args) => import("node-fetch").then(({ default: fetch }) => fetch(...args));
return (...args) =>
import("node-fetch").then(({ default: fetch }) => fetch(...args));
}

/**
Expand Down

0 comments on commit 9c87399

Please sign in to comment.