モジュール指定子

モジュール指定子

仕様書

解決

[2] モジュール指定子の解決 (resolve a module specifier) は、 基底URLJavaScript文字列指定子について、 次のようにします >>1

  1. [3] 結果を、指定子URL構文解析器を適用した結果に設定します。
  2. [4] 結果が失敗以外なら、
    1. [5] 結果を返します。
  3. [6] それ以外なら、
    1. [7] 指定子の先頭が /./../ のいずれかなら、
      1. [10] 基底URLについて指定子URL構文解析器を適用した結果を返します。
    2. [8] それ以外なら、
      1. [9] 失敗を返します。

[11] つまり絶対URL絶対パス./../ から始まる URL なら、普通の URL と解釈します。 しかし hogehoge など他の相対URLは将来の拡張のために予約されています >>1

[12] この処理は、 importモジュールスクリプトの作成と、 モジュールスクリプトfetch中に呼び出されます。

歴史

[13] Don't handle impossible errors in HostResolveImportedModule (domenic著, ) <https://github.com/whatwg/html/commit/616df18cd9e6c17878db5167909c69ca9f9d2906>

[14] Improve module instantiation/evaluation, especially around errors (domenic著, ) <https://github.com/whatwg/html/commit/2b408b65a11fe76b6588b744e0ae74d30ff29b43>

[15] Integrate dynamic import() (domenic著, ) <https://github.com/whatwg/html/commit/d4d1704f9c0efbeed78b885d566af17545b8b5fe>

[16] Editorial: “a module specifiers” → “module specifiers” (mathiasbynens著, ) <https://github.com/whatwg/html/commit/2757de33552e6d9d0169e5a99c268db49e18b972>

[17] Editorial: Fix typo by mathiasbynens · Pull Request #3192 · whatwg/html () <https://github.com/whatwg/html/pull/3192>

[18] Initialize script's base URL earlier (TimothyGu著, ) <https://github.com/whatwg/html/commit/34ca9e5dcaaba10b22553d3235aaf7eca919d7ab>

[19] Initialize script's base URL earlier by TimothyGu · Pull Request #3352 · whatwg/html () <https://github.com/whatwg/html/pull/3352>

[20] Editorial: change "resolve a module specifier" to take a URL (domfarolino著, ) <https://github.com/whatwg/html/commit/8176d055eaef62cad03327a7cc47c5c7926ffb0c>

[21] Resolve a module specifier now takes a base URL by domfarolino · Pull Request #3807 · whatwg/html () <https://github.com/whatwg/html/pull/3807>