Skip to content

Commit 81b03d8

Browse files
invariant.error should be called in prod (#12828)
Co-authored-by: Jerel Miller <jerelmiller@gmail.com>
1 parent 103664d commit 81b03d8

3 files changed

Lines changed: 13 additions & 5 deletions

File tree

.changeset/great-seas-buy.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"@apollo/client": minor
3+
---
4+
5+
`invariant.error` will now also log in production builds, not only dev builds

.size-limits.json

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
2-
"import { ApolloClient, InMemoryCache, HttpLink } from \"@apollo/client\" (CJS)": 43904,
3-
"import { ApolloClient, InMemoryCache, HttpLink } from \"@apollo/client\" (production) (CJS)": 38553,
4-
"import { ApolloClient, InMemoryCache, HttpLink } from \"@apollo/client\"": 33555,
5-
"import { ApolloClient, InMemoryCache, HttpLink } from \"@apollo/client\" (production)": 27554
2+
"import { ApolloClient, InMemoryCache, HttpLink } from \"@apollo/client\" (CJS)": 43776,
3+
"import { ApolloClient, InMemoryCache, HttpLink } from \"@apollo/client\" (production) (CJS)": 38564,
4+
"import { ApolloClient, InMemoryCache, HttpLink } from \"@apollo/client\"": 33542,
5+
"import { ApolloClient, InMemoryCache, HttpLink } from \"@apollo/client\" (production)": 27587
66
}

config/processInvariants.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -206,7 +206,10 @@ export async function processInvariants(options: BuildStepOptions) {
206206
});
207207
}
208208

209-
if (isDEVLogicalAnd(path.parent.node)) {
209+
if (
210+
isDEVLogicalAnd(path.parent.node) ||
211+
isIdWithName(node.callee.property, "error")
212+
) {
210213
return newNode;
211214
}
212215
fileRequiresDevImport = true;

0 commit comments

Comments
 (0)