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

The export default statement could not be found, however, it functions correctly when accessed from within the node

When I load the library with npm, @ckeditor/ckeditor5-build-classic, it works fine. I can easily use it by importing ClassicEditor from '@ckeditor/ckeditor5-build-classic'. import ClassicEditor from '@ckeditor/ckeditor5-build-classic' ...

An error occurred when trying to pass JSON data to the view in the "orchard" framework: TypeError - e.slice is not a function

public ActionResult Grouping() { return View(); } public ActionResult Read([DataSourceRequest] DataSourceRequest request, string text) { var result = _auto.Table.ToList().Where(s => s. ...

Removing an item from JSON data using Node.js and Express

Currently, I am attempting to remove an entry from json data. In order to view the data, I utilize the following: app.route('/data/:id') .get((req:Request, res: Response) => { let id = req.params.id; res.status(200).send(projects ...

In the realm of JavaScript, "this" is a key player when referring to an object within a factory

I created some JavaScript classes and FunctionFactories for them, but I believe there are errors in my implementation. To make the code more understandable, I decided to rename certain parts of it. The main class is called the "root"-class, which has chi ...

What sets aws-cdk-lib apart from @aws-cdk/core, @aws-cdk/aws-iam, and others?

There seems to be a variety of examples out there using the AWS CDK, with some referencing aws-cdk-lib and others using @aws-cdk/core. Can someone clarify the distinction between these two and provide guidance on when to use one over the other? ...

Using a dictionary of class types as input and returning a dictionary of their corresponding instances

Is there a way to create a function that takes a dictionary with class values as an argument and returns a dictionary of their instances? For example: classes C1, C2 function f: ({ name1: C1, name2: C2 }): ({ name1: new C1() name2: new C2 ...

Promise rejection not handled: The play() function was unsuccessful as it requires the user to interact with the document beforehand

After upgrading my application from Angular 10 to 11, I encountered an error while running unit tests. The error causes the tests to terminate, but strangely, sometimes they run without any issues. Does anyone have suggestions on how to resolve this issue? ...

What is the reason behind div elements shifting when hovering over a particular element?

Currently, I have floated all my div elements (icons) to the left and margin-lefted them to create space in between. I've displayed them inline as well. However, when I hover over one element (icon), the rest of the elements move. Can you please help ...

Ensuring User Authentication in Angular with Firebase: How to Dynamically Hide the Login Link in Navigation Based on User's Login Status

After successfully implementing Angular Firebase email and password registration and login, the next step is to check the user's state in the navigation template. If the user is logged in, I want to hide the login button and register button. I tried s ...

Month and year selection feature in ExtJS 4 catalog

I recently came across an interesting Fiddle that featured a Month and Year picker for apps. After finding this Fiddle here, I noticed that it was built using Extjs 5.0, and it worked perfectly. However, when attempting to switch it to version 4.2.1, the l ...

Plotting only the initial and final point on Google Maps using API

I am currently working on a tracking application that utilizes the Geolocation and Google Maps API. The app is set up to track the user's position using the watchPosition() function. As of now, a new blue icon is displayed every time a new longitude a ...

Exploring the distinctions between Django template variables and JavaScript variables

I am currently trying to populate a table in a Django template. The challenge I am facing is comparing cell values between a JavaScript variable and a Django template variable within the same context. Is there a way to perform this comparison without conve ...

Creating a toggle label using just CSS: a step-by-step guide

Recently, I was trying to create a toggle label using HTML, CSS, and JavaScript. Here is the code snippet that I experimented with: function genre_itemclick(item){ if(item.classList.contains('light_blue_border_button')) { ...

How can we enforce that only a certain type of ReactElement is allowed to be passed as props to a Component in TypeScript?

eslint and vscode seem to have trouble detecting validation errors when passing incompatible ReactElement types. Despite searching through documentation and examples, I haven't been able to find a solution that works. // Footer.tsx export interface ...

Are HTML's Regular Expressions the Equivalent of JavaScript's Regular Expressions?

I have been trying to utilize the pattern="" attribute in HTML to implement regex, but unfortunately, I am unable to locate a comprehensive list of HTML regex parameters. This has led me to ponder whether the syntax for regex in HTML is similar to JavaSc ...

What is the meaning of boolean true in a Firestore query using TypeScript?

Currently, I am facing an issue with querying Firestore in Angular 8 using AngularFire. While querying a string like module_version works perfectly fine as shown in the code snippet below, the problem arises when attempting to query a boolean field in Fire ...

Having trouble getting useFieldArray to work with Material UI Select component

I am currently working on implementing a dynamic Select field using Material UI and react-hook-form. While the useFieldArray works perfectly with TextField, I am facing issues when trying to use it with Select. What is not functioning properly: The defau ...

Designing an interactive HTML table that adapts to various screen

Currently utilizing Bootstrap to create a responsive HTML table on smaller devices like the iPad, but seeking a more polished and professional alternative. Searching for a JQuery/JavaScript or CSS solution without relying on plugins. Would appreciate any ...

What is the location of the JSBin installation?

I came across this page while trying to set up JSBin locally. After successfully installing xcode 8.2 on my Mac, running npm -v now returns 3.10.9, and node -v returns v7.2.1. When I run npm install, the following output is generated: /Users/softtimur/St ...

Assigning a Value to a Dropdown Menu in Angular

I have some JSON data that contains a True/False value. Depending on whether it is true or false, I want a specific option in a Select Dropdown to be automatically selected. This is the HTML code using Angular 16: <select name="reportNo" id=& ...