Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

javascript files for popup being built as service worker #207

Open
l1ionelw opened this issue Feb 14, 2024 · 0 comments
Open

javascript files for popup being built as service worker #207

l1ionelw opened this issue Feb 14, 2024 · 0 comments

Comments

@l1ionelw
Copy link

Describe the bug
javascript files for popup being built as service worker

To Reproduce
Steps to reproduce the behavior:

  1. Create new project
  2. In src folder, copy and paste code below
  3. Build and select dist folder to load unpacked in browser
  4. 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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

1 participant