Javascript 导入ES6模块时,路径是相对于HTML文件还是相对于JS文件?

Javascript 导入ES6模块时,路径是相对于HTML文件还是相对于JS文件?,javascript,es6-modules,Javascript,Es6 Modules,我想编写一个Javascript库,我想让用户只在HTML页面中导入库的主文件。然而,我看到如果我使用像 function dynamicallyLoadScript(url) { var script = document.createElement("script"); // create a script DOM node script.src = url; // set its src to the provided URL document.head.ap

我想编写一个Javascript库,我想让用户只在HTML页面中导入库的主文件。然而,我看到如果我使用像

function dynamicallyLoadScript(url) {
    var script = document.createElement("script");  // create a script DOM node
    script.src = url;  // set its src to the provided URL

    document.head.appendChild(script);  // add it to the end of the head section of the page (could change 'head' to 'body' to add it to the end of the body section instead)
}
(学分)

要包含的脚本的路径必须从HTML文件开始计算,这意味着用户必须将文件放在特定位置才能工作

我想知道是否值得重写这些文件以包含ES6模块。这样做会使脚本的路径相对于包含它的Javascript文件吗?如果没有,大型库如何处理这个问题