electrode-io / electrode-native

A platform to ease integration&delivery of React Native apps in existing mobile applications

Home Page:https://native.electrode.io

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Cannot add remote JS API Implementation with local MiniApp

ryanliljestrom opened this issue · comments

commented

We're working on upgrading our version of electrode from to 0.40.5 to 0.43.0. One thing that seems to have broken is our ability to build a local container with a JS API Implementation.

We use this as part of our runner building process to test a MiniApp. The rough command looks like:

ern create-container --jsApiImpls "@scoped/remote-api-impl" --miniapps "file://${PWD}" -p ios --outDir "${PWD}/output/container"

Things build fine, but when we attempt to launch our runner we get errors that no API implementation has been registered. If I use create-composite instead, it looks like the generated JS does not mention the API implementation at all. I'm going to try to find an exact version that introduced this issue, but looking at the change history I'm guessing 0.41 which introduced some optimizations for building local vs. remote components.

Build environment is macOS Catalina 10.15.2

UPDATE: It looks like this first broke in 0.41.0, I'm guessing with the following: #1554

Hi @ryanliljestrom

Thanks for the clear report and initial guess ! Will have a closer look at it.
Meanwhile one thing that you could try is to pass the JS API implementation package as a miniapp.
i.e:

ern create-container --miniapps @scoped/remote-api-impl "file://${PWD}" -p ios --outDir "${PWD}/output/container"

Let us know if that works or not. If it works, this would be a temporary workaround while waiting for a fix, and independently of the outcome, this will be helpful to know to help further investigation.

commented

I attempted the work-around by treating the API implementation as a MiniApp. Unfortunately, the composite generation fails. If I try to create-composite independently, it will create the files but fail with the below error:

Error: Path /.../output/composite/node_modules/react-native not found
    at Object.getNodeModuleVersion (~/.ern/versions/0.43.0/node_modules/ern-composite-gen/src/getNodeModuleVersion.ts:14:11)
    at Object.patchCompositeBabelRcRoots (~/.ern/versions/0.43.0/node_modules/ern-composite-gen/src/patchCompositeBabelRcRoots.ts:17:39)
    at generateFullComposite (~/.ern/versions/0.43.0/node_modules/ern-composite-gen/src/generateComposite.ts:294:5)

It does import the implementation in the index.js files, which is good. The generated package.json imports three dependencies:

  1. The @scoped/remote-api-impl
  2. ern-bundle-store-metro-asset-plugin@1.0.0
  3. react-native-svg-transformer@0.14.3

Honestly not sure if react-native is supposed to be included there or not.

The @scoped/remote-api-impl only has the API and a couple non-native JS libraries dependencies