mirror of
https://gitlab.com/soapbox-pub/shakespeare.git
synced 2026-12-05 16:23:36 +00:00
Cache redirected URLs in onLoad
This commit is contained in:
1 parent
50f60e59a1
commit
7d423c9829
1 file changed
+4
@@ -96,6 +96,10 @@ export function esmPlugin(packageLock: PackageLock, target?: string): Plugin {
|
||||
build.onLoad({ filter: /.*/, namespace: "esm" }, async (args) => {
|
||||
const res = await fetch(args.path);
|
||||
|
||||
if (res.redirected) {
|
||||
redirectedURLs.set(args.path, res.url);
|
||||
}
|
||||
|
||||
if (!res.ok) {
|
||||
throw new Error(`Failed to fetch ${args.path}`);
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user