Skip to content

Commit

Permalink
fix(dev): exclude node:-prefixed built-ins from the browser build
Browse files Browse the repository at this point in the history
  • Loading branch information
pcattori committed Jan 23, 2023
1 parent 3267cc7 commit 50b3070
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion packages/remix-dev/compiler/compileBrowser.ts
Original file line number Diff line number Diff line change
@@ -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";
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit 50b3070

Please sign in to comment.