Skip to content

Commit

Permalink
fix: yarn pnp resolution for empty modules
Browse files Browse the repository at this point in the history
  • Loading branch information
alisd23 committed Jul 1, 2022
1 parent f2c5226 commit f685817
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
10 changes: 8 additions & 2 deletions packages/remix-dev/compiler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -357,9 +357,15 @@ 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({
onLoad: async (args) => ({
contents: await fse.promises.readFile(args.path),
loader: `default`,
// https://esbuild.github.io/plugins/#on-load-results
resolveDir: path.dirname(args.path),
})
}),
];

return esbuild.build({
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 @@ -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.10",
"cacache": "^15.0.5",
"chalk": "^4.1.2",
"chokidar": "^3.5.1",
Expand Down

0 comments on commit f685817

Please sign in to comment.