Worker requires should support relative paths
Categories
(Toolkit :: General, task, P5)
Tracking
()
Tracking | Status | |
---|---|---|
firefox108 | --- | fixed |
People
(Reporter: jlast, Assigned: ochameau)
References
Details
Attachments
(1 file)
Currently, worker requires support absolute resource paths
importScripts("resource://gre/modules/workers/require.js");
const { createTask } = require("resource://devtools/shared/worker/helper.js");
It would be great if we could add a builder pattern similar to DevTools Browser loader that lets us specify a baseUri.
const { require } = BrowserLoader({
baseURI: "resource://devtools/client/debugger",
window
});
require('./src/main') ;
This is particularly useful now because the Debugger's workers are currently using commonjs requires and are being bundled via webpack source-map.js
Comment 1•6 years ago
|
||
Bugbug thinks this bug is a enhancement, but please change it back in case of error.
![]() |
Reporter | |
Updated•6 years ago
|
Updated•6 years ago
|
Comment 2•3 years ago
|
||
We're moving to ES6 modules, and away from require, so this issue seems obsolete.
Assignee | ||
Comment 3•3 years ago
|
||
Actually, this would be trivial to implement and would help me land an incremental steps toward ES6 modules in devtools.
In the debugger, we are currently using webpack to craft bundles as it is too complex to use commonjs in workers because of this limitation.
Using commonjs (like all other code in devtools) instead of webpack bundles is actually going to help move all devtools codebase from commonjs to ESM.
So I'm willing to add this feature. It will also help wait for ESM support in workers. We can keep using commonjs until this is implemented.
Assignee | ||
Comment 4•3 years ago
|
||
Updated•3 years ago
|
Updated•3 years ago
|
Comment 6•3 years ago
|
||
bugherder |
Description
•