Skip to content

Commit

Permalink
refactor(remix-dev): replace esbuild-plugin-polyfill-node with esbuil…
Browse files Browse the repository at this point in the history
…d-plugins-node-modules-polyfill (#6562)

Co-authored-by: Luke Askew <lukeaskew@gmail.com>
Co-authored-by: Ivo Todorov <ivo.gtodorov@gmail.com>
  • Loading branch information
3 people authored Jun 8, 2023
1 parent 4de1c13 commit a23338b
Show file tree
Hide file tree
Showing 7 changed files with 170 additions and 22 deletions.
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.

0 comments on commit a23338b

Please sign in to comment.