javascript - Using chrome storage API with create-react-app build -


i'm creating chrome extension , bootstrapped project using create-react-app.

general problem:

i want access chrome.storage api in react app

specific issues:

i want able use chrome.storage api in react app store settings created script in src directory tried calling chrome.storage.sync.set() , got 'chrome' not defined no-undef. think because need include script makes call in manifest. problem can't include script src in manifest because after create-react-app builds project, src gets minified , file structure changed.

the other problem create-react-app enforces import src need data public, can't make chrome api calls importing functions public. know there eject feature on create-react-app want maintain build features create-react-app gives me.

how can maintain create-react-app's build feature while getting access chrome.storage api src directory?

that error ('chrome not defined no-undef') looks linting error; linter comes create-react-app thinks chrome undefined because code never defines it. little linter know, chrome extensions, it's global variable, you don't have define it.

try adding /* global chrome */ top of file(s) use(s) chrome variable.


Comments

Popular posts from this blog

What is happening when Matlab is starting a "parallel pool"? -

php - Cannot override Laravel Spark authentication with own implementation -

angular - DownloadURL return null in below code -