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
?