Bug 201692 - ES Modules should respect <base> tag
Summary: ES Modules should respect <base> tag
Status: NEW
Alias: None
Product: WebKit
Classification: Unclassified
Component: JavaScriptCore (show other bugs)
Version: Safari 12
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Yusuke Suzuki
URL:
Keywords: InRadar
Depends on:
Blocks:
 
Reported: 2019-09-11 11:50 PDT by Guy Bedford
Modified: 2022-11-29 22:28 PST (History)
5 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Guy Bedford 2019-09-11 11:50:27 PDT
When using the <base href> tag, the value should affect the resolution of ES modules when resolving top-level module scripts with relative imports.

For example:

```
<base href="/modules/" />
<script type="module">
import './module.js';
</script>
```

should load `/modules/module.js` and not `/module.js`.
Comment 1 Guy Bedford 2019-09-11 11:55:32 PDT
Correction: the problem is specifically for dynamic imports:

```
<base href="/modules/" />
<script type="module">
import('./module.js');
</script>
```

where the top-level parent for the dynamic import should still respect the base.
Comment 2 Radar WebKit Bug Importer 2019-09-13 20:23:26 PDT
<rdar://problem/55361194>
Comment 3 Yusuke Suzuki 2020-06-15 18:22:52 PDT
The problem is that import is using SourceOrigin information. We should add a flag to that like, "this source is inlined script etc.".