Source code
Revision control
Copy as Markdown
Other Tools
Test Info: Warnings
- This test has a WPT meta file that expects 1 subtest issues.
- This WPT test may be referenced by the following Test IDs:
- /import-maps/multiple-import-maps/conflict-first-persists.html - WPT Dashboard Interop Dashboard
<!DOCTYPE html>
<html>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script type="importmap">
{
"imports": {
"module-a": "../resources/log.js?pipe=sub&name=ModuleA",
"module-b/something": "../resources/log.js?pipe=sub&name=ModuleB"
}
}
</script>
<script type="importmap">
{
"imports": {
"module-a": "../resources/log.js?pipe=sub&name=OtherModuleA",
"module-b/": "../resources/log.js?pipe=sub&name=PrefixModuleB",
"module-b": "../resources/log.js?pipe=sub&name=OtherModuleB"
}
}
</script>
<script>
const test_loaded = (specifier, expected_log, description) => {
promise_test(async t => {
log = [];
await import(specifier);
assert_array_equals(log, expected_log);
}, description);
};
test_loaded(
"module-a",
["log:ModuleA"],
"First defined rule persists in case of conflict"
);
test_loaded(
"module-b/something",
["log:ModuleB"],
"First defined rule persists in case of conflict - prefixed bare specifiers"
);
test_loaded(
"module-b",
["log:OtherModuleB"],
"First defined rule persists in case of conflict - non-prefix bare specifier"
);
</script>
</html>