electrode-native icon indicating copy to clipboard operation
electrode-native copied to clipboard

Bundler error in Typescript miniapps

Open romanlv opened this issue 5 years ago • 5 comments

When attempting to ern run-ios miniapps created with Typescript support I'm getting

✖ Generating Container locally 11s
  ✖ Generating Container 11s
    ✔ Preparing Native Dependencies Injection 0s
    ✔ Preparing API Implementations Injection 0s
    ✔ Injecting Native Dependencies 3s
    ✔ Adding Native Dependencies Hooks 0s
    ✖ Bundling MiniApps 4s
      ✖ Running Metro Bundler 4s
  ✖ runLocalContainerGen failed: Error: Command failed: /Users/vn0epsg/.ern/versions/0.34.0/node_modules/ern-core/nod
e_modules/.bin/react-native bundle --entry-file=index.js --dev=false --platform=ios --bundle-output=/Users/vn0epsg/.e
rn/containergen/out/ios/ElectrodeContainer/Libraries/MiniApp/MiniApp.jsbundle --assets-dest=/Users/vn0epsg/.ern/conta
inergen/out/ios/ElectrodeContainer/Libraries/MiniApp 
  ✖ error Unable to resolve module `react-native/Libraries/NewAppScreen` from `/private/var/folders/w1/fr2ppby15bjb5t
6mb0hrx059h5v0_t/T/tmp-64231I2QN7RvX41xe/node_modules/ts-miniapp/App.tsx`: Module `react-native/Libraries/NewAppScree
n` does not exist in the Haste module map

It seems to be related to this react-native-template-typescript issue

ℹ ern-local-cli : 0.34.0 ℹ electrode-native : 1.0.17

Js based apps start fine

romanlv avatar Jul 17 '19 19:07 romanlv

Hi @romanlv Thanks for reporting this one and doing some initial research. As described in the issue you linked, the TypeScript template that we are using internally when generating a TypeScript MiniApp (the exact one you linked) is always targeting latest version of React Native. That is going to cause problems as Electrode Native users are using different versions of React Native and not always latest. We'll look into that ASAP and probably release a patch version of Electrode Native to include a fix. Given that react-native CLI does not currently support templates for different versions of RN, we'll have to come up with our own solution. Meanwhile, if your'e blocked, have your tried the workaround suggested in this comment ? https://github.com/react-native-community/react-native-template-typescript/issues/42#issuecomment-510827188

belemaire avatar Jul 17 '19 20:07 belemaire

Thanks, @belemaire, also, it looks like adding typescript support to existing JS miniapp works without negative side effects. So this issue maybe not so urgent then

romanlv avatar Jul 17 '19 20:07 romanlv

yes, and I tried to remove globally installed react-native, replace with ERN version 0.59.8 and it didn't work

romanlv avatar Jul 17 '19 20:07 romanlv

On one hand it's not urgent because there is a way to work-around the issue, but on the other hand it's urgent because our MiniApp TypeScript generator won't work for any users at this point (because the template we use is targeting 0.60 of RN and no other versions and we don't yet support this version of RN). We'll do the necessary to fix this and do a patch release sometime this week.

belemaire avatar Jul 17 '19 21:07 belemaire

@romanlv - It's been a while, but if you have a few minutes, could you check if the latest version of ERN solves this issue? Thank you!

friederbluemle avatar May 13 '20 00:05 friederbluemle