提交前检查
用户脚本链接
触发问题的目标网站
问题表现与对比
Tampermonkey: true + true
Violentmonkey: true + true
ScriptCat: false + false
// ==UserScript==
// @name Dynamic Import URL Resolution Test
// @namespace http://tampermonkey.net/
// @version 0.0.1
// @description Verify how dynamic import() resolves absolute and relative module paths.
// @author You
// @match https://*/*
// @grant GM_setValue
// ==/UserScript==
(async function () {
'use strict';
async function testImportResolution(label, specifier) {
const expectedUrl = new URL(specifier, document.URL).href;
let errorMessage = '';
try {
await import(specifier);
} catch (error) {
errorMessage = String(error?.message ?? error);
}
return {
Test: label,
Specifier: specifier,
'Expected URL': expectedUrl,
Passed: errorMessage.includes(expectedUrl),
Error: errorMessage,
};
}
const results = await Promise.all([
// https://github.com/scriptscat/
// /js/services/test.js
// → https://github.com/js/services/test.js
testImportResolution(
'Absolute path resolves from origin root',
'/js/services/test.js'
),
// https://github.com/scriptscat/
// ./js/services/test.js
// → https://github.com/scriptscat/js/services/test.js
testImportResolution(
'Relative path resolves from current page',
'./js/services/test.js'
),
]);
console.table(results);
})();
用户脚本 metadata
ScriptCat 版本
v1.5.0-beta.2
系统 / 浏览器及版本
Helium latest
最小复现脚本 / 日志 / 截图
No response
提交前检查
用户脚本链接
触发问题的目标网站
问题表现与对比
Tampermonkey: true + true
Violentmonkey: true + true
ScriptCat: false + false
用户脚本 metadata
-ScriptCat 版本
v1.5.0-beta.2
系统 / 浏览器及版本
Helium latest
最小复现脚本 / 日志 / 截图
No response