guocaoyi / create-chrome-ext

🍺 Scaffolding your Chrome extension! Boilerplates: react \ vue \ svelte \ solid \ preact \ alpine \ lit \ stencil \ inferno \ vanilla
MIT License
1.72k stars 125 forks source link

Uncaught TypeError: Cannot read properties of undefined (reading 'sync') #81

Closed ChrisGrigg closed 7 months ago

ChrisGrigg commented 7 months ago

Forgive my ignorance if I'm barking up the wrong tree I'm brand new to chrome extension development. When I try npm run dev then visit http://localhost:5173/sidepanel.html

I get the error;

react-dom_client.js?v=b833d8d0:16657 Uncaught TypeError: Cannot read properties of undefined (reading 'sync') at SidePanel.tsx:10:20

In other words the chrome.storage property is undefined. Is there any way around this or does it need to be in a chrome extension environment i.e. load unpacked into the chrome://extensions/?

dannyrb commented 4 months ago

@ChrisGrigg did you get this sorted? I feel like I'm missing something obvious, or trying to see if I have to polyfill with alternative implementations to test locally