Skip to content

Commit 501847e

Browse files
committed
Parsing package.json files will now skip browser fields if it contains multiple paths.
1 parent 40d94ba commit 501847e

File tree

2 files changed

+10
-1
lines changed

2 files changed

+10
-1
lines changed

README.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -105,6 +105,14 @@ The LanguageService will not track any mutations for already-initialized variabl
105105

106106
## Changelog:
107107

108+
**v1.0.32**:
109+
110+
- Parsing package.json files will now skip browser fields if it contains multiple paths.
111+
112+
**v1.0.31**:
113+
114+
- Fixed a bug with the previous version.
115+
108116
**v1.0.30**:
109117

110118
- Fixed a bug with the previous version.

src/formatter/ModuleFormatter.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -151,7 +151,8 @@ export abstract class ModuleFormatter implements IModuleFormatter {
151151

152152
for (const field of fields) {
153153
const value = json[field];
154-
if (value != null) return join(packageJSONPath, "../", value);
154+
// The "browser" field may be an object of nested paths. Skip if that is the case.
155+
if (value != null && typeof value === "string") return join(packageJSONPath, "../", value);
155156
}
156157

157158
return null;

0 commit comments

Comments
 (0)