Skip to content

Build issues using Expo EAS #763

@jonlaing

Description

@jonlaing

The problem

I was trying to build my Expo app which uses this package, and I was running into problems that weren't immediately obvious. After some sleuthing I eventually found this line in the Xcode error log.

Error loading assets JSON from Metro. Ensure you've followed all 
expo-updates installation steps correctly. 

Unable to resolve module rescript-react-native/src/apis/Style.bs.js from 
/Users/expo/workingdir/build/components/rescript /<mycomponent>.bs.js: 

rescript-react-native/src/apis/Style.bs.js could not be found within the project or in these directories:
node_modules

What I eventually realized is that this package ships only with the *.res files, and you're expected to build the *.bs.js files yourself. Conversely, EAS installs your node_modules fresh after upload during the build process, so none of those files get compiled on the EAS server.

Considered solution

I was able to fix it by adding the following to my package.json:

{
  // ...
  "scripts": {
    // ...
    "eas-build-post-install": "yarn rescript clean && yarn rescript build"
  }
  // ...
}

This tells the EAS build system to build the rescript files after it runs yarn install (and pod install for iOS specifically).

I think the most straight forward solution is to just add this to the docs and on the website. Just save some people the headache of running into this problem and not being sure how to solve it.

Alternatives solutions

I guess the package could bundle *.bs.js files, but I don't know if that's even the right solution. I think a line in the docs is probably sufficient.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions