electron-react-boilerplate
electron-react-boilerplate copied to clipboard
localStorage is blank in packaged version only
Prerequisites
- [x ] Using npm
- [x ] Using an up-to-date
mainbranch - [x ] Using latest version of devtools. Check the docs for how to update
- [x ] Tried solutions mentioned in #400
- [x ] For issue in production release, add devtools output of
DEBUG_PROD=true npm run build && npm start
Expected Behavior
My application relies on window.localStorage.getItem() and window.localStorage.setItem(). These work between pages using react-router-dom MemoryRouter in development, but when I package, all localStorage is null.
Current Behavior
The application displays blank fields from localStorage.
Steps to Reproduce
-
Run npm run start
-
localStorage functionality works
-
Run npm run package
-
localStorage functionality doesn't work (blank)
Possible Solution (Not obligatory)
Context
I am trying to persist data between pages. For now I am using IPC calls to save state.
I do see these warnings running npm run start, I'm not sure if they're related:
(node:72382) ExtensionLoadWarning: Warnings loading extension at /Users/alana/Library/Application Support/[application]/extensions/fmkadmapgofadopljbjfkapdkoienihi:
Permission 'scripting' is unknown or URL pattern is malformed.
(Use `Electron --trace-warnings ...` to show where the warning was created)
[72382:0726/131900.358915:ERROR:render_process_host_impl.cc(3766)] Request for unknown Channel-associated interface: extensions.mojom.ServiceWorkerHost
[72382:0726/131900.363013:ERROR:extensions_browser_client.cc(67)] Extension Error:
OTR: false
Level: 2
Source: chrome-extension://padaoheoklmhfgbbfjaakkchnpkfoegd/build/background.js
Message: Uncaught TypeError: chrome.tabs.query is not a function
ID: padaoheoklmhfgbbfjaakkchnpkfoegd
Type: RuntimeError
Context: chrome-extension://padaoheoklmhfgbbfjaakkchnpkfoegd/build/background.js
Stack Trace:
{
Line: 208
Column: 1
URL: chrome-extension://padaoheoklmhfgbbfjaakkchnpkfoegd/build/background.js
Function: (anonymous function)
}
[72382:0726/131900.363636:ERROR:extensions_browser_client.cc(67)] Extension Error:
OTR: false
Level: 1
Source: manifest.json
Message: Service worker registration failed. Status code: 15
ID: padaoheoklmhfgbbfjaakkchnpkfoegd
Type: ManifestError
[72382:0726/131900.364104:ERROR:extensions_browser_client.cc(67)] Extension Error:
OTR: false
Level: 2
Source: chrome-extension://padaoheoklmhfgbbfjaakkchnpkfoegd/build/background.js
Message: Uncaught (in promise) TypeError: Cannot read properties of undefined (reading 'ExecutionWorld')
ID: padaoheoklmhfgbbfjaakkchnpkfoegd
Type: RuntimeError
Context: chrome-extension://padaoheoklmhfgbbfjaakkchnpkfoegd/build/background.js
Stack Trace:
{
Line: 59
Column: 1
URL: chrome-extension://padaoheoklmhfgbbfjaakkchnpkfoegd/build/background.js
Function: (anonymous function)
}
Your Environment
- Node version : 20.3.1
- electron-react-boilerplate version or branch : main
- Operating System and version : Mac OS Ventura 13.1
- Link to your project :