diff --git a/noname.js b/noname.js index ab93299fa..0e58fdd9b 100644 --- a/noname.js +++ b/noname.js @@ -1,4 +1,4 @@ -export const rootURL = new URL(import.meta.url); +export const rootURL = new URL("../", import.meta.url); export { GNC, gnc, setGNC } from "./noname/gnc/index.js"; export { AI, ai, setAI } from "./noname/ai/index.js"; diff --git a/noname/get/index.js b/noname/get/index.js index 8f9f61019..2c8292102 100644 --- a/noname/get/index.js +++ b/noname/get/index.js @@ -4803,11 +4803,7 @@ export class Get { * console.log(parsedPath == `${lib.assetURL}noname/get/index.js`) //=> true */ relativePath(url, addAssetURL = false) { - let base = lib.path.relative(decodeURI(rootURL.pathname), decodeURI(url.pathname)).slice(3); - // 由于`rootURL`的实现,当且仅当url指向`~/noname.js`时,会变为空字符串 - if (base == "") { - base = "noname.js"; - } + let base = lib.path.relative(decodeURI(rootURL.pathname), decodeURI(url.pathname)); if (addAssetURL && rootURL.protocol == "file:") { base = `${lib.assetURL}${base}`; }