You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Many libraries avoid this by doing a check that doesn't presume the existence of the global variable, e.g. if (typeof __DEV__ !== 'undefined' && __DEV__) instead of if (__DEV__).
Individual apps could work around having dependencies like this that do raw checks on __DEV__ by implementing their own webpack plugins to rewrite __DEV__ and then apply this to the appropriate modules in their build; but this can be a problem if using this library in a shared package like a components library, because it forces every consumer to add this config to their web builds, which can be difficult in some environments.
There are a couple of raw checks on
__DEV__
in logger.ts that will cause a hard crash if @gorhom/portals is used in a default React Native Web build. The cause is that React Native Web doesn't define a global__DEV__
variable like React Native does.Many libraries avoid this by doing a check that doesn't presume the existence of the global variable, e.g.
if (typeof __DEV__ !== 'undefined' && __DEV__)
instead ofif (__DEV__)
.Individual apps could work around having dependencies like this that do raw checks on
__DEV__
by implementing their own webpack plugins to rewrite__DEV__
and then apply this to the appropriate modules in their build; but this can be a problem if using this library in a shared package like a components library, because it forces every consumer to add this config to their web builds, which can be difficult in some environments.I'm happy to put up a PR for this [edit] - #30
The text was updated successfully, but these errors were encountered: