shirakaba / react-nativescript

React renderer for NativeScript
https://react-nativescript.netlify.com
MIT License
280 stars 14 forks source link

JS ERROR Error: Cannot find module after tns migrate #32

Closed Lelelo1 closed 4 years ago

Lelelo1 commented 5 years ago

When tns run ios --no-hmr- I encountered the prompt to update:

prompt

So I ran tns migrate - but it created an error:

file:///app/app.ts:1:74 JS ERROR Error: Cannot find module './AppContainer'

...That wouldn't go away. I made sure the export and import where correct - and had made no recent edits to the code.


It was solved by copying the old tsconfig.tns.json and webpack.config.js into the migrated project version - since I read the tns upgrade made edits to those files

shirakaba commented 5 years ago

Interesting! Yes, RNS isn’t officially supported by the NativeScript Core team (and therefore the NativeScript CLI) yet. As you guessed, the command likely overwrites those two config files with NativeScript Core in mind. Specifically, AppContainer wasn’t found because that script must have removed the rule that tells the Webpack loader to look for tsx files.

I can’t fix this myself, unfortunately; the Core team will have to step in and support RNS first.

But this does remind me: I’d better upgrade the sample project to NS 6 (it’s currently on NS 5.4). I have an NS 6 project working fine by following the repo instructions, so I can confirm that NS 6 is supported by RNS, at least.

shirakaba commented 5 years ago

I upgraded the sample project to NS 6 today. Here's the diff that you need to apply when upgrading a NativeScript 5.x project to 6.x: 34fe0d9

shirakaba commented 5 years ago

The NativeScript CLI team have instructed me on how to support starter templates, and to some extent hooks, which will have some impact on the tns migrate experience – though this would probably only be from {N} version 6 onwards.

It's on my to-do list to complete (but I'm quite busy this month).

shirakaba commented 4 years ago

I've provided a React template for NativeScript CLI:

tns create myApp --template tns-template-blank-react
cd myApp
tns run ios

I'm not sure what's involved in tns migrate. If it simply diffs between versions of the template, then my work here is done. If it's something more elaborate, then it's out-of-scope for me anyway, as the CLI tools are developed by the NativeScript team.