Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor(remix-dev): replace esbuild-plugin-polyfill-node with esbuild-plugins-node-modules-polyfill #6562

Merged
merged 9 commits into from
Jun 8, 2023
6 changes: 6 additions & 0 deletions .changeset/polyfill-replacement.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
"remix": patch
"@remix-run/dev": patch
---

replace esbuild-plugin-polyfill-node with esbuild-plugins-node-modules-polyfill
1 change: 1 addition & 0 deletions contributors.yml
Original file line number Diff line number Diff line change
Expand Up @@ -318,6 +318,7 @@
- luk-str
- lukahartwig
- lukasgerm
- LukeAskew
- lukeshiru
- m0nica
- m5r
Expand Down
4 changes: 2 additions & 2 deletions packages/remix-dev/compiler/css/compiler.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { builtinModules as nodeBuiltins } from "module";
import * as esbuild from "esbuild";
import { polyfillNode as NodeModulesPolyfillPlugin } from "esbuild-plugin-polyfill-node";
import { nodeModulesPolyfillPlugin } from "esbuild-plugins-node-modules-polyfill";

import type { RemixConfig } from "../../config";
import { getAppDependencies } from "../../dependencies";
Expand Down Expand Up @@ -81,7 +81,7 @@ const createEsbuildConfig = (ctx: Context): esbuild.BuildOptions => {
externalPlugin(/^https?:\/\//, { sideEffects: false }),
mdxPlugin(ctx),
emptyModulesPlugin(ctx, /\.server(\.[jt]sx?)?$/),
NodeModulesPolyfillPlugin(),
nodeModulesPolyfillPlugin(),
externalPlugin(/^node:.*/, { sideEffects: false }),
],
supported: {
Expand Down
4 changes: 2 additions & 2 deletions packages/remix-dev/compiler/js/compiler.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import * as path from "path";
import { builtinModules as nodeBuiltins } from "module";
import * as esbuild from "esbuild";
import { polyfillNode as NodeModulesPolyfillPlugin } from "esbuild-plugin-polyfill-node";
import { nodeModulesPolyfillPlugin } from "esbuild-plugins-node-modules-polyfill";

import type { RemixConfig } from "../../config";
import { type Manifest } from "../../manifest";
Expand Down Expand Up @@ -133,7 +133,7 @@ const createEsbuildConfig = (
externalPlugin(/^https?:\/\//, { sideEffects: false }),
mdxPlugin(ctx),
emptyModulesPlugin(ctx, /\.server(\.[jt]sx?)?$/),
NodeModulesPolyfillPlugin(),
nodeModulesPolyfillPlugin(),
externalPlugin(/^node:.*/, { sideEffects: false }),
{
// TODO: should be removed when error handling for compiler is improved
Expand Down
4 changes: 2 additions & 2 deletions packages/remix-dev/compiler/server/compiler.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import * as esbuild from "esbuild";
import { polyfillNode as NodeModulesPolyfillPlugin } from "esbuild-plugin-polyfill-node";
import { nodeModulesPolyfillPlugin } from "esbuild-plugins-node-modules-polyfill";

import { type Manifest } from "../../manifest";
import { loaders } from "../utils/loaders";
Expand Down Expand Up @@ -67,7 +67,7 @@ const createEsbuildConfig = (
];

if (ctx.config.serverPlatform !== "node") {
plugins.unshift(NodeModulesPolyfillPlugin());
plugins.unshift(nodeModulesPolyfillPlugin());
}

return {
Expand Down
2 changes: 1 addition & 1 deletion packages/remix-dev/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
"chokidar": "^3.5.1",
"dotenv": "^16.0.0",
"esbuild": "0.17.6",
"esbuild-plugin-polyfill-node": "^0.2.0",
"esbuild-plugins-node-modules-polyfill": "^1.0.13",
"execa": "5.1.1",
"exit-hook": "2.2.1",
"express": "^4.17.1",
Expand Down
171 changes: 156 additions & 15 deletions yarn.lock

Large diffs are not rendered by default.