diff --git a/packages/remix-dev/compiler/compileBrowser.ts b/packages/remix-dev/compiler/compileBrowser.ts index 62c8bf8da89..86c31d0d584 100644 --- a/packages/remix-dev/compiler/compileBrowser.ts +++ b/packages/remix-dev/compiler/compileBrowser.ts @@ -1,6 +1,6 @@ import * as path from "path"; import * as fse from "fs-extra"; -import { builtinModules as nodeBuiltins } from "module"; +import { builtinModules } from "module"; import * as esbuild from "esbuild"; import { NodeModulesPolyfillPlugin } from "@esbuild-plugins/node-modules-polyfill"; import postcss from "postcss"; @@ -35,6 +35,14 @@ export type BrowserCompiler = { dispose: () => void; }; +let nodeBuiltins = Array.from( + new Set([ + ...builtinModules, + // account for `node:`-prefixed built-ins like `"node:fs"` + ...builtinModules.map((x) => `node:${x}`), + ]) +); + const getExternals = (remixConfig: RemixConfig): string[] => { // For the browser build, exclude node built-ins that don't have a // browser-safe alternative installed in node_modules. Nothing should