Skip to content

Commit

Permalink
fix(optimizer): use vite resolver for yarn 2 fallback
Browse files Browse the repository at this point in the history
fix #1778
  • Loading branch information
yyx990803 committed Jan 28, 2021
1 parent f54839a commit 475aae4
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions packages/vite/src/node/optimizer/esbuildDepPlugin.ts
Expand Up @@ -97,8 +97,8 @@ export function esbuildDepPlugin(

// yarn 2 pnp compat
if (isRunningWithYarnPnp) {
build.onResolve({ filter: /.*/ }, (args) => ({
path: require.resolve(args.path, { paths: [args.resolveDir] })
build.onResolve({ filter: /.*/ }, async ({ path, importer }) => ({
path: await resolve(path, importer)
}))
build.onLoad({ filter: /.*/ }, async (args) => ({
contents: await require('fs').promises.readFile(args.path),
Expand Down

0 comments on commit 475aae4

Please sign in to comment.