Skip to content

Instantly share code, notes, and snippets.

@iartemiev
Last active September 21, 2021 21:27
Show Gist options
  • Save iartemiev/7ed6b8a5c82e6bc2db8eb7725c29c04c to your computer and use it in GitHub Desktop.
Save iartemiev/7ed6b8a5c82e6bc2db8eb7725c29c04c to your computer and use it in GitHub Desktop.
AWS Amplify DataStore Contributing Guide (a.k.a. This One Simple Trick Will Save You Hours Of Debugging Time)

From the library source:

  1. Fork the amplify-js repo in GitHub and clone it locally
  2. Run yarn setup-dev
  3. Run yarn build:watch

From your sample app:

  1. Run yarn link aws-amplify @aws-amplify/core @aws-amplify/datastore @aws-amplify/auth @aws-amplify/ui-components @aws-amplify/ui-react @aws-amplify/api @aws-amplify/api-graphql
    • You may not need all of these, but might as well link them just in case
  2. Import any dependencies into your app from aws-amplify, e.g.,
import Amplify, { DataStore } from 'aws-amplify';
  1. Start your app
  2. The app should work correctly with the linked dependencies
    • Any time you make changes to the Amplify library code source, the package should re-build on save and your sample app should hot reload to reflect the changes.
    • When using DataStore, there may be some funk with IndexedDB throwing errors after a Hot Reload/Refresh, in which case a manual page reload should fix it.
    • Source maps should work correctly and map back to the original TypeScript code
    • Easiest way to open a particular library source file in Chrome Dev Tools > Sources is with ⌘+P and type the name, e.g., datastore.ts
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment