Skip to content

Commit

Permalink
perf(resolve): fix browser mapping nearest package.json check
Browse files Browse the repository at this point in the history
  • Loading branch information
bluwy committed Mar 23, 2023
1 parent 6ea4be2 commit c046c65
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion packages/vite/src/node/plugins/resolve.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1214,7 +1214,7 @@ function tryResolveBrowserMapping(
const pkg =
importer &&
(idToPkgMap.get(importer) ||
findNearestPackageData(importer, options.packageCache))
findNearestPackageData(path.dirname(importer), options.packageCache))
if (pkg && isObject(pkg.data.browser)) {
const mapId = isFilePath ? './' + slash(path.relative(pkg.dir, id)) : id
const browserMappedPath = mapWithBrowserField(mapId, pkg.data.browser)
Expand Down

0 comments on commit c046c65

Please sign in to comment.