error object for failed loading of dynamically imported module is incomplete
Categories
(Core :: JavaScript Engine, enhancement, P3)
Tracking
()
Tracking | Status | |
---|---|---|
firefox115 | --- | fixed |
People
(Reporter: daajay1, Assigned: allstars.chh)
References
(Blocks 1 open bug)
Details
Attachments
(1 file)
User Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/111.0.0.0 Safari/537.36
Steps to reproduce:
Hi I'm front-end developer and I'm working on react.js based app - we've implemented lazy-loading with retries functionality based on this article and I've found out that there's different behaviour on firefox when it is compared to working properly Chrome.
https://medium.com/@alonmiz1234/retry-dynamic-imports-with-react-lazy-c7755a7d557a
Actual results:
Basically how the lazyWithRetries functionality works - if we fail to load dynamic lazy module - for loop starts - it takes error.message property and extracts URL of the module, in chrome this error looks like this:
{
"stack": "TypeError: Failed to fetch dynamically imported module: http://localhost:3000/assets/LazyComponent-03ed4069.js",
"message": "Failed to fetch dynamically imported module: http://localhost:3000/assets/LazyComponent-03ed4069.js"
}
Then after URL is created, we're adding timestamp to search params - just to deal with browser caching unloaded properly module.
Unfortunately for firefox here's how error looks like:
{
"fileName": "",
"lineNumber": 0,
"columnNumber": 0,
"message": "error loading dynamically imported module"
}
So creating the URL from message property is impossible.
Expected results:
I'd like firefox to return either URL of file that failed in error message or return file in fileName property, it would be much more readable error response and something can be done with it. For now it is impossible to retry with another request when lazy module is loaded so experience of users in web-apps can be worse than in chrome.
Comment 1•2 years ago
|
||
I will set this enhancement as new so the engineering team could decide if they take in consideration changing this.
Comment 3•2 years ago
|
||
The Bugbug bot thinks this bug should belong to the 'Core::DOM: Networking' component, and is moving the bug to that component. Please correct in case you think the bot is wrong.
Updated•2 years ago
|
Comment 4•2 years ago
|
||
Jon, would you have any idea who would be the person to look at this issue?
Comment 5•2 years ago
|
||
I agree it would be nice if the error message included the URL.
Maybe Yoshi could take a look at this?
Assignee | ||
Updated•2 years ago
|
Assignee | ||
Comment 6•2 years ago
|
||
Comment 8•2 years ago
|
||
bugherder |
Description
•