Two (or more) apps with same codebase

I’ve searched high and low and found no clear way to do it.

To get practical, here is what I tried:

I found that you can have a custom js module resolver using rn-cli.config.js (or maybe now metro.config.js)

I tried adding this file, but TBH I’m not even sure if my config is being picked up.

I tried two different configurations (I’m not sure exactly what it means so I’m just blindly trying stuff hoping something will work):

module.exports = {
  getProjectRoots() {
    return [
      path.resolve(__dirname, '../packages'),
      path.resolve(__dirname, 'node_modules'),
  }
};

Or…

Object.keys(installedDependencies).forEach(dep => {
  extraNodeModules[dep] = path.resolve(__dirname, 'node_modules', dep);
});
module.exports = {
  getProjectRoots() {
    return [path.resolve(__dirname), path.resolve(__dirname, '../packages')];
  },
  extraNodeModules: extraNodeModules,
};

My first local import in my App.js looks something like:

import { xyz } from 'auth/helpers';

This file lives above my expo app root (in …/packages/auth/helpers.js). And I get and error like:

Unable to resolve module 'auth/helpers' from 'C:\........

I also tried to import ‘./auth/helpers’ because I wasn’t not sure which one is expected. Any ideas how I can get this working? Thanks.