Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

186
Views
How to write a firefox add-on using parceljs?

I created a basic firefox sidebar extension and now I want to rewrite it with the help of parceljs

The extension works by getting information from the browser tab. Now that I'm trying to rewrite it in parceljs, browser.tab doesn't seem to work

This is what I have without parceljs

//manifest.json
    "sidebar_action": {
        "default_icon": "icon.png",
        "default_title": "Theme integrated sidebar",
        "default_panel": "sidebar/index.html",
        "open_at_install": false
    }
// sidebar/index.html

<script src="main.js"></script>
<script src="extension.js"></script>

// extension.js

 browser.tabs.onUpdated.addListener(function (tabId, changeInfo, tab) {
    if (changeInfo.status == "complete") {
      GetInitialInfo(tab);
    }
  });
function GetInitialInfo(tab) {
  document.body.style.backgroundColor = "#202020";
  const string = "watch?v";
  if (findLetter(tab.url, string)) {
    YoutubeScript(url, tab.title, "editor_countainer");
  }
}
// main.js
function YoutubeScript(youtube_url, title, container) {
  fetchData(youtube_url, title);
  // and then is just a case of injecting data in the dom
}

With parceljs.js I tried this**

//manifest.json
    "sidebar_action": {
        "default_icon": "icon.png",
        "default_title": "Theme integrated sidebar",
        "default_panel": "sidebar/dist/index.html",
        "open_at_install": false
    }
// sidebar/index.html
<script src="extension.js"></script>
// extension.js
 import "./main.js"
 browser.tabs.onUpdated.addListener(function (tabId, changeInfo, tab) {
    if (changeInfo.status == "complete") {
      GetInitialInfo(tab);
    }
  });
function GetInitialInfo(tab) {
  document.body.style.backgroundColor = "#202020";
  const string = "watch?v";
  if (findLetter(tab.url, string)) {
    YoutubeScript(url, tab.title, "editor_countainer");
  }
}

I have to change the index.html output by adding a dot in src=".extension.js". Then everything work apart from the browser.tab, that doesn't work

about 4 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!