extension-cli
extension-cli copied to clipboard
javascript files for popup being built as service worker
Describe the bug javascript files for popup being built as service worker
To Reproduce Steps to reproduce the behavior:
- Create new project
- In src folder, copy and paste code below
- Build and select dist folder to load unpacked in browser
- Error is thrown
Expected behavior
- Extension should load without errors
**Desktop: **
- OS: Building on MacOS
- Browser: Chrome 121.0.6167.160
- Node JS 20.11.0
Manifest JSON:
"action": {
"default_popup": "popup.html"
},
"permissions": [
"storage",
"bookmarks"
],
"background": {
"service_worker": "background.js",
"type": "module"
}
background.js:
console.log("background js service worker")
popup.js
console.log("popup js script")
Service Worker logs: background js service worker popup js script
Scripts in popup.html file which includes document.getelement(element), which throws an error (document not found) when it is built as a service worker, requiring scripts in popup to be inline.