kriasoft / react-firebase-starter

Boilerplate (seed) project for creating web apps with React.js, GraphQL.js and Relay

Home Page:https://firebase.reactstarter.com

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

no-undef error with global variable to be used in Prod only (injected by Android Webview)

atalebagha opened this issue · comments

I'm developing a webpage that will be viewed inside an Android webview environment. That webview will inject a global variable which is a Javascript interface for the Android App.

Let's say the variable is AndroidClient.

I have the following code inside a helper function:

function signin() {
  if (typeof AndroidClient !== 'undefined') {
    AndroidClient.signIn();
  else {
    console.log('signing in');
  }
};

I'm getting the following build errors when I run the dev server, and I updated eslintrc to only warn about 'no-undef' error yet I'm still getting a build error.

./src/helpers.js
  Line 6:  'AndroidClient' is not defined  no-undef

How can I resolve this within a create react app / react-scripts environment?

@atalebagha how tried using it like this instead: window.AndroidClient?