Add error message for importmap with src attribute
Categories
(Core :: JavaScript Engine, task, P3)
Tracking
()
Tracking | Status | |
---|---|---|
firefox110 | --- | fixed |
People
(Reporter: nchevobbe, Assigned: allstars.chh)
References
Details
Attachments
(1 file)
(deleted),
text/x-phabricator-request
|
Details |
Steps to reproduce
- Open a tab on https://ffx-external-import-map.glitch.me/
- Open the console
Result
As I was testing out importmap, I tried declaring as we do for external script:
<script type="importmap" src="map.json"></script>
In such case, I do get an error on the console as the importmap
isn't loaded, and thus the import
fails
Uncaught TypeError: The specifier “square” was a bare specifier, but was not remapped to anything. Relative module specifiers must start with “./”, “../” or “/”. module.js:1:27
But I don't get any error about the importmap being invalid (unlike in Bug 1808357).
It would be nice to have an error (or warning) message to indicate that the importmap can't be specified in an external file and should be inlined
Assignee | ||
Comment 1•2 years ago
|
||
Per spec, the onerror handler of the script tag will be called if it's external script with type is "importmap".
See
https://html.spec.whatwg.org/multipage/scripting.html#prepare-the-script-element
Step 30.1
Reporter | ||
Comment 2•2 years ago
|
||
(In reply to Yoshi Cheng-Hao Huang [:allstars.chh][:allstarschh][:yoshi] from comment #1)
Per spec, the onerror handler of the script tag will be called if it's external script with type is "importmap".
See
https://html.spec.whatwg.org/multipage/scripting.html#prepare-the-script-element
Step 30.1
That's good to know but do require people to know about the onerror
handler too. Having a warning message would be a nice way to reduce frustration for users so they don't have to search around what's going on
Assignee | ||
Comment 3•2 years ago
|
||
I will try to dump some error message in console.
Updated•2 years ago
|
Assignee | ||
Updated•2 years ago
|
Assignee | ||
Comment 4•2 years ago
|
||
Comment 6•2 years ago
|
||
bugherder |
Description
•