Web Static Assets Folder per environment

Please provide the following:

  1. SDK Version: 45
  2. Platforms(Android/iOS/web/all): web

We are publishing our Expo managed workflow on the web using react-native-web, ultimately hosted on Heroku. We are serving a handful of static files from “within” the app by placing them in a “web” folder at the top level. The important ones for this question are the files that are used to “authenticate” our domains with Apple and Google for universal links, namely:

  • /.well-known/assetlinks.json
  • /.well-known/apple-app-site-association

These files hold the associations between our Apple/Google app identities and the domain(s) on which these files are hosted. All works well for our staging environment with universal links working on both platforms.

However, as we move to build a production app, we have a second domain name (the “real” one where the customer-facing web-app will live), and so we need to host different versions of these files on the 2 domains (but from the same codeset). This is because there are separate staging and production versions of the apps on Google/Apple, and so I need different associations for each domain.

So, the question is, how can I serve different static assets based on the environment being deployed? I’m struggling to find documentation on possible approaches:

  1. Change the location static asset folder (so I can use “web” and “web-test” for example) and vary somehow in the webpack build process
  2. Convert the static file into something dynamic that varies the response based on environment variables
  3. Just add both app details (staging and production) to the same association files and “hope that this works” in the sense that the other side of the association (the one in the app, configured per-environment in app.config.js only points to one of the 2 domains - staging or production)

Has anyone tackled this issue before and worked out an approach?

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