From d31c47ca95d79e2354e26a26da40b5fbd541c14d Mon Sep 17 00:00:00 2001
From: Ali Sheehan-Dare <alisd23@live.co.uk>
Date: Fri, 1 Jul 2022 17:15:51 +0200
Subject: [PATCH] fix: bump yarn esbuild plugin (adds resolveDir support for
 pnp imports)

---
 packages/remix-dev/compiler.ts  | 3 +--
 packages/remix-dev/package.json | 2 +-
 yarn.lock                       | 8 ++++----
 3 files changed, 6 insertions(+), 7 deletions(-)

diff --git a/packages/remix-dev/compiler.ts b/packages/remix-dev/compiler.ts
index b74de1b850f..8b82559d4ee 100644
--- a/packages/remix-dev/compiler.ts
+++ b/packages/remix-dev/compiler.ts
@@ -357,9 +357,8 @@ async function createBrowserBuild(
     mdxPlugin(config),
     browserRouteModulesPlugin(config, /\?browser$/),
     emptyModulesPlugin(config, /\.server(\.[jt]sx?)?$/),
-    // Must be placed before NodeModulesPolyfillPlugin, so yarn can resolve polyfills correctly
-    yarnPnpPlugin(),
     NodeModulesPolyfillPlugin(),
+    yarnPnpPlugin(),
   ];
 
   return esbuild.build({
diff --git a/packages/remix-dev/package.json b/packages/remix-dev/package.json
index 09a7dd4cecc..c9e58a4b512 100644
--- a/packages/remix-dev/package.json
+++ b/packages/remix-dev/package.json
@@ -26,7 +26,7 @@
     "@npmcli/package-json": "^2.0.0",
     "@remix-run/server-runtime": "1.6.2",
     "arg": "^5.0.1",
-    "@yarnpkg/esbuild-plugin-pnp": "^2.0.0",
+    "@yarnpkg/esbuild-plugin-pnp": "3.0.0-rc.11",
     "cacache": "^15.0.5",
     "chalk": "^4.1.2",
     "chokidar": "^3.5.1",
diff --git a/yarn.lock b/yarn.lock
index bb679c44a03..5624dcf7e15 100644
--- a/yarn.lock
+++ b/yarn.lock
@@ -2572,10 +2572,10 @@
   resolved "https://registry.npmjs.org/@xmldom/xmldom/-/xmldom-0.7.5.tgz"
   integrity sha512-V3BIhmY36fXZ1OtVcI9W+FxQqxVLsPKcNjWigIaa81dLC9IolJl5Mt4Cvhmr0flUnjSpTdrbMTSbXqYqV5dT6A==
 
-"@yarnpkg/esbuild-plugin-pnp@^2.0.0":
-  version "2.0.1"
-  resolved "https://registry.yarnpkg.com/@yarnpkg/esbuild-plugin-pnp/-/esbuild-plugin-pnp-2.0.1.tgz#120faad903d40e8f000ed3c9db9f9055c9612800"
-  integrity sha512-M8nYJr8S0riwy4Jgm3ja88m5ZfW6zZSV8fgLtO1mXpwTg0tD9ki1ShPOSm9DEbicc350TVf+k/jVNh6v1xApCw==
+"@yarnpkg/esbuild-plugin-pnp@3.0.0-rc.11":
+  version "3.0.0-rc.11"
+  resolved "https://registry.yarnpkg.com/@yarnpkg/esbuild-plugin-pnp/-/esbuild-plugin-pnp-3.0.0-rc.11.tgz#5cd829662b916a3dbbdc5a76913380f1913d2b65"
+  integrity sha512-uwTdgbw9XIisx7oxqHrX7GFjsObxo5EhUYGjIg17TdHyAqgwZV6Ca7rqTjKZryLFoxkCFyMloxkclyze0onpQQ==
   dependencies:
     tslib "^1.13.0"