Skip to content

Commit

Permalink
Assign unique error codes to production invariant errors.
Browse files Browse the repository at this point in the history
Inspired by #4519.

Implemented and explained by apollographql/invariant-packages#1.
  • Loading branch information
benjamn committed Mar 4, 2019
1 parent ffd4744 commit d668ca4
Show file tree
Hide file tree
Showing 13 changed files with 36 additions and 28 deletions.
10 changes: 9 additions & 1 deletion config/rollup.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,15 @@ export function rollup({
module: true,
}),
typescriptPlugin({ typescript, tsconfig }),
invariantPlugin(),
invariantPlugin({
// Instead of completely stripping InvariantError messages in
// production, this option assigns a numeric code to the
// production version of each error (unique to the call/throw
// location), which makes it much easier to trace production
// errors back to the unminified code where they were thrown,
// where the full error string can be found. See #4519.
errorCodes: true,
}),
],
onwarn,
},
Expand Down
6 changes: 3 additions & 3 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
{
"name": "apollo-utilities",
"path": "./packages/apollo-utilities/lib/bundle.cjs.min.js",
"maxSize": "4.15 kB"
"maxSize": "4.2 kB"
}
],
"lint-staged": {
Expand Down Expand Up @@ -89,7 +89,7 @@
"react": "16.8.3",
"react-dom": "16.8.3",
"rollup": "1.2.2",
"rollup-plugin-invariant": "^0.3.2",
"rollup-plugin-invariant": "^0.4.0",
"rollup-plugin-local-resolve": "1.0.7",
"rollup-plugin-node-resolve": "4.0.1",
"rollup-plugin-sourcemaps": "0.4.2",
Expand Down
8 changes: 4 additions & 4 deletions packages/apollo-boost/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion packages/apollo-boost/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@
"apollo-link-error": "^1.0.3",
"apollo-link-http": "^1.3.1",
"graphql-tag": "^2.4.2",
"ts-invariant": "^0.2.1",
"ts-invariant": "^0.3.0",
"tslib": "^1.9.3"
},
"peerDependencies": {
Expand Down
8 changes: 4 additions & 4 deletions packages/apollo-cache-inmemory/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion packages/apollo-cache-inmemory/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@
"apollo-cache": "file:../apollo-cache",
"apollo-utilities": "file:../apollo-utilities",
"optimism": "^0.6.9",
"ts-invariant": "^0.2.1",
"ts-invariant": "^0.3.0",
"tslib": "^1.9.3"
},
"peerDependencies": {
Expand Down
2 changes: 1 addition & 1 deletion packages/apollo-cache/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 4 additions & 4 deletions packages/apollo-client/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion packages/apollo-client/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@
"apollo-link-dedup": "^1.0.0",
"apollo-utilities": "file:../apollo-utilities",
"symbol-observable": "^1.0.2",
"ts-invariant": "^0.2.1",
"ts-invariant": "^0.3.0",
"tslib": "^1.9.3",
"zen-observable": "^0.8.0"
},
Expand Down
8 changes: 4 additions & 4 deletions packages/apollo-utilities/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion packages/apollo-utilities/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@
},
"dependencies": {
"fast-json-stable-stringify": "^2.0.0",
"ts-invariant": "^0.2.1",
"ts-invariant": "^0.3.0",
"tslib": "^1.9.3"
}
}
2 changes: 1 addition & 1 deletion packages/graphql-anywhere/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit d668ca4

Please sign in to comment.