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

@parcel/config-webextension: fail to handle chrome.runtime.getURL("popup.html") #10087

Open
link89 opened this issue Feb 10, 2025 · 0 comments
Open

Comments

@link89
Copy link

link89 commented Feb 10, 2025

🐛 bug report

I am using parcel to build a chrome extension, in which need to create a window at runtime. The entry of the window is generate via chrome.runtime.getURL("popup.html"). But parcel can not handle it properly.

function createPopupAndSend(message: DownloadEvent) {
  chrome.windows.create({
    url: chrome.runtime.getURL("popup.html"),
    type: "popup",
    // Assume a suitable size for the popup window.
    width: 600,
    height: 500,
  }, (newWindow) => {
    if (newWindow && newWindow.id !== undefined) {
      popupWindowId = newWindow.id;
      // Delay sending the message to give the popup time to load.
      setTimeout(() => {
        chrome.runtime.sendMessage(message);
      }, 500);
    }
  });
}

🎛 Configuration (.babelrc, package.json, cli command)

manifest.json

{
  "manifest_version": 3,
  "name": "Beat Saber Songs Downloader",
  "version": "1.0",
  "description": "A Chrome Extension to send files via ADB to Android devices using WebUSB.",
  "permissions": [
    "usb",
    "storage",
    "windows"
  ],
  "background": {
    "service_worker": "src/background.ts"
  },
  "action": {
    "default_title": "Beat Saber Songs Downloader"
  },
  "host_permissions": [
    "<all_urls>"
  ],
  "content_scripts": [
    {
      "matches": ["<all_urls>"],
      "js": ["contentScript.js"]
    }
  ]
}

build command

parcel build manifest.json --config @parcel/config-webextension --no-scope-hoist",

🤔 Expected Behavior

Build everything related to the entry popup.html should be built.

😯 Current Behavior

Everything related to popup.html is not built.

💁 Possible Solution

🔦 Context

💻 Code Sample

🌍 Your Environment

Software Version(s)
Parcel 2.13.3
Node
npm/Yarn
Operating System
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant