Skip to content

Commit

Permalink
new error extraction mechanism (#10887)
Browse files Browse the repository at this point in the history
Co-authored-by: Jerel Miller <jerelmiller@gmail.com>
  • Loading branch information
phryneas and jerelmiller authored May 26, 2023
1 parent 79df2c7 commit f8c0b96
Show file tree
Hide file tree
Showing 56 changed files with 811 additions and 430 deletions.
17 changes: 17 additions & 0 deletions .changeset/hungry-chairs-live.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
---
'@apollo/client': minor
---

Add a new mechanism for Error Extraction to reduce bundle size by including
error message texts on an opt-in basis.
By default, errors will link to an error page with the entire error message.
This replaces "development" and "production" errors and works without
additional bundler configuration.
Bundling the text of error messages and development warnings can be enabled by
```js
import { loadErrorMessages, loadDevMessages } from "@apollo/client/dev";
if (process.env.NODE_ENV !== "production") {
loadErrorMessages();
loadDevMessages();
}
```
8 changes: 8 additions & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,17 @@
# Do not format anything automatically except files listed below
*

!config/
config/*
!config/processInvariants.ts

##### PATHS TO BE FORMATTED #####
!src/
src/*
!src/react/
src/react/*

!src/dev

# Allow src/react/cache/ApolloProvider
!src/react/context/
Expand Down Expand Up @@ -65,6 +70,9 @@ src/utilities/common/*
src/utilities/common/__tests__/*
!src/utilities/common/__tests__/omitDeep.ts
!src/utilities/common/__tests__/stripTypename.ts
!src/utilities/globals
src/utilities/globals/*
!src/utilities/globals/invariantWrappers.ts
!src/utilities/graphql
src/utilities/graphql/*
!src/utilities/graphql/operations.ts
Expand Down
4 changes: 2 additions & 2 deletions .size-limit.cjs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
const checks = [
{
path: "dist/apollo-client.min.cjs",
limit: "37.06kb"
limit: "37460"
},
{
path: "dist/main.cjs",
Expand All @@ -10,7 +10,7 @@ const checks = [
{
path: "dist/index.js",
import: "{ ApolloClient, InMemoryCache, HttpLink }",
limit: "35.31kb"
limit: "33243"
},
...[
"ApolloProvider",
Expand Down
1 change: 1 addition & 0 deletions config/entryPoints.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ const entryPoints = [
{ dirs: [], bundleName: "main" },
{ dirs: ['cache'] },
{ dirs: ['core'] },
{ dirs: ['dev'] },
{ dirs: ['errors'] },
{ dirs: ['link', 'batch'] },
{ dirs: ['link', 'batch-http'] },
Expand Down
Loading

0 comments on commit f8c0b96

Please sign in to comment.