Skip to content

Commit

Permalink
Correctly handle empty resolver diagnostics array (#9407)
Browse files Browse the repository at this point in the history
  • Loading branch information
mischnic authored Mar 18, 2024
1 parent e9c1970 commit 8cfc9c7
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
8 changes: 7 additions & 1 deletion packages/core/core/src/requests/PathRequest.js
Original file line number Diff line number Diff line change
Expand Up @@ -368,7 +368,13 @@ export class ResolverRunner {
};
}

if (result.diagnostics) {
if (
result.diagnostics != null &&
!(
Array.isArray(result.diagnostics) &&
result.diagnostics.length === 0
)
) {
let errorDiagnostic = errorToDiagnostic(
new ThrowableDiagnostic({diagnostic: result.diagnostics}),
{
Expand Down
2 changes: 1 addition & 1 deletion packages/utils/node-resolver-core/src/Wrapper.js
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,7 @@ export default class NodeResolver {
? diagnostic
: diagnostic
? [diagnostic]
: [],
: undefined,
invalidateOnFileCreate: res.invalidateOnFileCreate,
invalidateOnFileChange: res.invalidateOnFileChange,
};
Expand Down

0 comments on commit 8cfc9c7

Please sign in to comment.