Handling module import errors in react native android emulator - javascript

Development Error: 500
This is an error is have seemingly been completely unable to solve on my own, it appears to have something to do with importing modules and dependencies. however, I have tried everything I could within that perceptive and it has become clear that I have asbolutetly no clue how to solve this seemingly simple problem.
let me know if you have experience solving this issue, it seems all the other postings on stacking and GitHub are mostly useless.

Related

Required props undefined in chrome 83

So after installing chrome 83 one of my pages in my app crashes. It says some of my props that's required is undefined. This only happens in chrome. I've tested in IE 11, Edge, Firefox and it works fine in those. It doesn't happen all the time either in chrome. Especially if i restart my localhost it might work a couple of times and then it starts breaking. I've also checked sha1d on master branch couple of weeks back and it also breaks there. This was never an issue before and started just recently. There has been no code changes for weeks related to that page. Any ideas what can cause this in chrome?
Based on what you are saying if problem only started happening recently in chrome, and this could be the failure of the prop-types library, its the library responsible for showing such a warning a required prop is undefined.
To make sure that it is indeed the problem of the prop-types library, you can switch environment to production, as this library should not work in prod. If indeed its the problem of this library you could try the following
Maybe try removing react dev tools and see if problem still happens
clean install of the library
update the library

React Native - Expo Stuck on "Downloading Javascript Bundle 100%"

For months I've been working on this project and never once came across this issue.
Suddenly expo does not go beyond the splash screen, I've searched multiple forums and none of the suggested solutions worked.
I've tried:
Uninstalling and reinstalling expo (both mobile and PC)
Clearing expo data on mobile
Stopping remote debugging
Clearing yarn cache
Undoing last known changes.
Updating my Expo CLI
I commented everything and prevented navigation away from the startup page, then tried printing only a text output in a View.
I built a new blank expo project which works, but I'd rather not transfer all of my code to a new project, it doesn't seem like a logical fix since the new project would just become the old once everything is moved.
There are no errors in the code, I can deliberately cause a syntax error and it'll display as usual with the error screen on mobile and in the terminal log, once the error is fixed it goes back to not passing the splash screen again.
Update:
I've commented every line in the project and removed comments one by one to see when the problem occurs. Here is what I've found, it occurs:
When I include import { Ionicons } from "#expo/vector-icons"; but it doesn't cause the same issue when the same import is used in another route.
When I include Stylesheet.create({...}) even though Stylesheet works in other routes.
When I include import * as ImagePicker from 'expo-image-picker'; and this works fine when used in other routes also.
There doesn't seem to be a pattern.

ReactJs Exception in production, unable to reproduce, looking for help to reproduce it

In the following picture you can see a exception from my production loggserver. I cannot for the life of me figure out what the problem is, nor can I reproduce the problem in any browser.
Failed to execute 'removeChild' on 'Node': The node to be removed is not a child of this node.
I'm looking for a good way to reproduce an error like this.. I do not run any jquery or anything that would modify the dom.. I use semantic-ui-react (according them they do not run jquery either)
I guess some user could use Google-translate or something that would modify the dom and cause a crash of react, but seems farfetched.
I also do not swallow exceptions in my api-calls (which seems to be a common thing that people warn about when searching for this on google.)
I run React 16.8.4

Sporadically get error only in iFrame: Main.js Interpreted as amd module format, but called System.register

I'm seeing the error below in console only when loading in iframe when loading compiled ES6 Javascript classes using SystemJS v 0.19.41.
system.src.js:3054 Uncaught Error: Module https://d1jbmqjs327xbn.cloudfront.net/_ra/spaces-developer.pxand/assets/js/framework/builder/builder-client.js interpreted as amd module format, but called System.register.
at a. (system.src.js:3054)
at a. (system.src.js:3773)
at a.reduceRegister_ (system.src.js:4268)
at HTMLScriptElement.m (system.src.js:2851)
This seems to be the same issue as the one that was closed a couple years ago, but for this case it only happens in an iframe.
https://github.com/systemjs/systemjs/issues/970
It happens consistently in Safari, but sporadically in Chrome. The issue only started last week with no code change so I'm at a lost on what could have gone wrong. When this error occurs, it simply stop execute the Javascript which is very problematic.
Anyone has any idea on what could be the root cause of this issue?
Just in case this helps anyone. I found that the issue was with jQuery UI as it's using AMD by default. I had to revert back to an older version to fix this issue. The only explanation I have for the sporadic behavior in Chrome is that Chrome doesn't consistently execute scripts at the same rate unlike Safari. However, this still doesn't explain why I started seeing the issue all the sudden without any change.
So if this ever happens to you, look for a library that loads dependencies using AMD by default and either load them using import instead or if you don't have a choice, try rearrange the order of import and move the one that's causing the issue up. For my case, that's not possible and that's why I had to use an older version of jQuery UI.
As for why it only happens when it's in an iframe. Well, it remains a mystery. I can only think that it's because how content in iframe is loaded by browser. I would love to hear an opinion from an expert on this.

ionic2 not loading javascript import in UWP app

I have an ionic2 app that works great in the browser however when I try to run it as a UWP app it fails with the following error:
JavaScript runtime error: Uncaught (in promise): Error: Error in :0:0 caused by: 'Oidc' is undefined
I'm using an oidc library in just one class so I went and looked there and I have the following:
import * as Oidc from 'oidc-client';
This seems to work fine when running the app in the browser but it doesn't seem to get picked up when run as an app. I don't know if this is a ionic build issue/ webpack / or most likely just my ignorance since i'm relying on a lot of pieces I don't fully understand.
I fixed this issue by directly referencing the script in my index.html file:
<script src="oidc-client.min.js"></script>
but that really seems like the wrong solution. Can someone point me in the right direction? I want to understand why my import sometimes works.
edit: Also no errors made it back to ionic cli. I had to load this up in Visual Studio to find the problem
I can't say for sure since I'm not familiar with Oidc, but sometimes doing 'import *' or 'export ' can break things when working with ionic 2 or just straight up angular 2. I think it's more of a webpack related issue. We've had weird build issues or stupid 'X is undefined' issues in our development and oftentimes it's been related to using the wildcards (I think technically they're called barrels?). Also, some libraries don't play nicely with ES6 modules, although that might not be your case since it runs fine in the browser. Once though I had a really small use case for jquery in an angular 2 app, and the only way to get it in the app was by sticking a link in the index.html. But my gut tells me your problem is with the import statement.

Categories