Trouble with modules not resolving when saving Snack via SDK

Hey Expo team,

I’m utilizing the Snack SDK and trying to allow users to save their Snack session and be given a link to their project in Snack.

Here’s the URL of an example that I’m working with: My App - Snack. When I go to this project, click Run, and scan the QR code, I get the error:

File '(null)' isn't readable.
  Evaluating module://@draftbit/ui.js
  Evaluating module://App.js.js
  Loading module://App.js

It seems that the @draftbit/ui dependency isn’t being loaded. To fix this, I have to remove the @draftbit/ui dependency from package.json, re-add it, and shake + refresh my Snack session in the Expo mobile app. Things seem to work then. Not a huge deal in this case, but for some of our more complex projects with multiple dependencies it’s very hard to save using the Snack SDK and get a working Snack example.

Also, when I call the saveAsync method, the URL returned is https://expo.io/@snack/HkceKRDlH - I’m assuming this should be the URL posted above.

Hey Donald,
I suspect you aren’t adding the module to the session before saving.
Snack itself always uses the latest version of snack-sdk, so you can always see how we’re using it if something isn’t working for you. snack-web/App.tsx at master · expo/snack-web · GitHub

Cheers,
TC

1 Like

Hey TC, that was exactly my issue. Thanks so much for the quick response. Appreciate the insight on snack-web as well, will use that as a reference going forward.

Donald

This topic was automatically closed 20 days after the last reply. New replies are no longer allowed.