File tree 1 file changed +3
-3
lines changed
packages/vite/src/node/plugins
1 file changed +3
-3
lines changed Original file line number Diff line number Diff line change @@ -827,8 +827,8 @@ export function tryNodeResolve(
827
827
! (
828
828
ext === '.cjs' ||
829
829
( ext === '.js' &&
830
- findNearestPackageData ( resolved , options . packageCache ) ?. data . type !==
831
- 'module' )
830
+ findNearestPackageData ( path . dirname ( resolved ) , options . packageCache )
831
+ ?. data . type !== 'module' )
832
832
) &&
833
833
! ( include ?. includes ( pkgId ) || include ?. includes ( id ) ) )
834
834
@@ -1206,7 +1206,7 @@ function tryResolveBrowserMapping(
1206
1206
const pkg =
1207
1207
importer &&
1208
1208
( idToPkgMap . get ( importer ) ||
1209
- findNearestPackageData ( importer , options . packageCache ) )
1209
+ findNearestPackageData ( path . dirname ( importer ) , options . packageCache ) )
1210
1210
if ( pkg && isObject ( pkg . data . browser ) ) {
1211
1211
const mapId = isFilePath ? './' + slash ( path . relative ( pkg . dir , id ) ) : id
1212
1212
const browserMappedPath = mapWithBrowserField ( mapId , pkg . data . browser )
You can’t perform that action at this time.
0 commit comments