Skip to content

Commit

Permalink
fix(optimizer): browser mapping for yarn pnp
Browse files Browse the repository at this point in the history
  • Loading branch information
swandir committed Jan 13, 2022
1 parent 6ecf9b0 commit a4777e8
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions packages/vite/src/node/optimizer/esbuildDepPlugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -209,9 +209,14 @@ export function esbuildDepPlugin(
if (isRunningWithYarnPnp) {
build.onResolve(
{ filter: /.*/ },
async ({ path, importer, kind, resolveDir }) => ({
async ({ path, importer, kind, resolveDir, namespace }) => ({
// pass along resolveDir for entries
path: await resolve(path, importer, kind, resolveDir)
path: await resolve(
path,
importer,
kind,
namespace === 'dep' ? resolveDir : undefined
)
})
)
build.onLoad({ filter: /.*/ }, async (args) => ({
Expand Down

0 comments on commit a4777e8

Please sign in to comment.