Serving sourcemaps for a web extension in Firefox: A step-by-step guide

Currently in the process of developing a web extension using TypeScript, I have encountered an issue with sourcemaps not loading properly. The use of parcel to bundle my extension has made the bundling process simple and straightforward. However, while the sourcemaps for contentscripts are functioning correctly and can be used for debugging, the same cannot be said for the background scripts.

Upon attempting to debug in Firefox, I received an error message regarding the failure to fetch the resource when trying to load the sourcemap for the background script. This led me to believe that there may be a problem with how the sourcemaps are being provided to the browser. Even though the syntax for both scripts is identical, it appears that Firefox might require a different method of hosting for the background script.

To showcase this issue, I have created a repository which can be accessed at https://github.com/lhk/webextension_typescript_webpack. Following the outlined steps, you can reproduce the problem and observe the error message in the debug console output.

  • npm install -g parcel-bundler
  • git clone https://github.com/lhk/webextension_typescript_webpack
  • git checkout parcel_branch
  • npm install
  • parcel build src/manifest.json

UPDATE: During my investigation, I came across an issue on GitHub related to Firefox's handling of certain types of sourcemaps within web extensions. It seems that Firefox has specific requirements for sourcemaps, which may explain why they work for contentscripts but not for background scripts.

Answer №1

Although I have already included this as an update to my original question, upon further reflection, I believe it actually constitutes an answer.

Interestingly enough, there is a known issue on GitHub that addresses this very problem. The most recent comment remains relevant: https://github.com/webpack/webpack/issues/1194#issuecomment-402494524

This issue seems to be rooted in a bug within the Firefox browser. A corresponding bug report has been submitted to Mozilla as well: https://bugzilla.mozilla.org/show_bug.cgi?id=1437937

Similar questions

If you have not found the answer to your question or you are interested in this topic, then look at other similar questions below or use the search

Pause execution of javascript function for a short period

When the button is clicked, my script executes the function manage($n) $onclick = "manage('$n');"; However, I also want to refresh the page immediately after it is clicked. $onclick="window.location.reload(true);manage('$n')"; Altho ...

Steps to display a text box once the dropdown list is updated

I have a dropdown menu with two options <div class="form-group"> <span class="col-sm-4 control-span">Member Type</span> <div class="col-sm-8"> <select class="form-control" id="membertype" name="me ...

Resolving search box setup problem in PrimeNG dataView

I am working on integrating p-dataView with Angular 5 but encountering an error Cannot read property 'split' of undefined at DataView.filter Despite checking the documentation, I have been unable to find a solution to this issue. It seems lik ...

Guide to creating JSDoc for a TouchEvent handler

Looking to improve my shorter-js codebase with JSDoc for TypeScript definitions, but hitting a roadblock. I've implemented the on() function using Element.addEventListener, working well so far. However, when passing a TouchEvent as a parameter for an ...

Is it possible to import the headers from a CSV file into a table for the purpose of comparing them to the existing headers in the system?

I'm currently working on loading two CSV files - one is the default for our system, while the other is the file we want to import. My goal is to create a table displaying the default content on one side and providing a dropdown list for selecting colu ...

Make sure accordion items stay open even when another one is clicked

I have implemented an accordion component that currently opens and closes on click. However, I am facing an issue where clicking on one item closes another item that was previously open, which is not the behavior I desire. I'm unsure of the best appro ...

The Angular Material md-input-container consumes a significant amount of space

Currently, I am exploring a sample in Angular Material. It appears that the md-input-container tag is taking up a substantial amount of space by default. The output is shown below: However, I have come across the md-input-content tag, which occupies less ...

Encountering a parse error when making an AJAX call using structural functions

I'm in the process of developing an API and here is my PHP function. function retrieve_schools($cn){ $schools_query = "SELECT * FROM schools"; $school_result = mysqli_query($cn, $schools_query); $response_array['form_data'][&apo ...

Problems encountered with an API for newsletter signups

The form I created allows users to input their email and sends it to my Sendgrid contacts list. However, there are a couple of issues that need addressing: After submission, the page gets stuck on loading The frontend logic is not functioning as desi ...

Make the textarea larger and bring it to the forefront when it is selected

I would like to make a textarea expand (increase its height) when it is in focus. The expanded textarea should not push the content down, but rather be displayed above other content. Currently, this is the code I am using (check out the example here): $( ...

Utilize JavaScript or jQuery to segment HTML elements

Looking for a front-end solution to a common practice. In the past, I've stored reusable HTML elements (such as <nav>, <header>, <footer>, etc.) in a functions.php file and used PHP functions to include them on multiple pages. This ...

Discover the most effective method for identifying duplicate items within an array

I'm currently working with angular4 and facing a challenge of displaying a list containing only unique values. Whenever I access an API, it returns an array from which I have to filter out repeated data. The API will be accessed periodically, and the ...

Is there a way to retrieve the requested data in useEffect when using next.js?

As a newcomer to next.js and TypeScript, I am facing an issue with passing props from data retrieved in useEffect. Despite my attempts, including adding 'return scheduleList' in the function, nothing seems to work. useEffect((): (() => void) = ...

The ashx file is triggered with every server control postback in jqgrid

I have an asp .net webforms page with a jqgrid, as well as several other server controls. The jqgrid is populated using an ashx file which retrieves data from the database and binds it successfully. Challenge Whenever a postback occurs (such as from a dro ...

Having difficulty setting up and launching a React Application

When attempting to execute the create-react-app command, I am encountering some issues. Below is the sequence of commands that I am trying: create-react-app my-app cd my-app npm start Unfortunately, I am facing errors while running the above commands. A ...

Encountering an issue with TypeScript after applying a wrapper to a Material-UI button - specifically, the error message states that the type '{ children: string; color: "light-green"; }' is lacking certain properties

I'm currently working on creating wrapped components using MUI (@material-tailwind/react) within the environment of Next.js 14. However, I've run into a typescript error specifically in the MaterialButton component. Type '{ children: string; ...

trigger the f:setPropertyActionListener function upon clicking the button following the onclick event

On a page with a datatable displaying all users, each row includes "edit" and "delete" buttons. The issue arises when trying to delete a user by clicking on the "delete" button. Upon clicking the button, a confirmation dialog is displayed using PrimeFaces ...

Typescript: Retrieve an interface containing properties that are found in interface A, but not in interface B

I am currently developing a mapper that will facilitate the translation between a serialized entity state and a form state. In the context of two given interfaces A and B, I am exploring ways to derive a third interface C that includes properties present ...

How to utilize dot notation in HTML to iterate through nested JSON in AngularJS?

I'm struggling with displaying nested objects loaded from a JSON file in Angular. I've seen examples of using dot notations in HTML to access nested data, but I'm new to Angular and can't seem to get it right. The JSON is valid, but I j ...

"Ajax has the ability to alter the vertical scroll position

I have a quick query for you. Can anyone assist me in understanding why the page scroll resets to the top after an Ajax request? I suspect it has something to do with JQuery. There isn't much information available online, so I'm reaching out for ...