URL-based paths


这意味着包含 #? 等特殊字符的文件需要转义。

如果用于解析模块的 import 说明符具有不同的查询或片段,则会多次加载模块。

import './foo.mjs?query=1'; // 加载具有 "?query=1" 查询的 ./foo.mjs
import './foo.mjs?query=2'; // 加载具有 "?query=2" 查询的 ./foo.mjs

ES modules are resolved and cached based upon URL semantics. This means that files containing special characters such as # and ? need to be escaped.

Modules are loaded multiple times if the import specifier used to resolve them has a different query or fragment.

import './foo.mjs?query=1'; // loads ./foo.mjs with query of "?query=1"
import './foo.mjs?query=2'; // loads ./foo.mjs with query of "?query=2"

For now, only modules using the file: protocol can be loaded.