refactor: change the point of `rootURL`.
This commit is contained in:
parent
3016b46439
commit
6226a8ba85
|
@ -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";
|
||||
|
|
|
@ -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}`;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue