From 44249c7c25e138971af908fa9a54a37741ebaace Mon Sep 17 00:00:00 2001 From: Praful Koppalkar Date: Tue, 16 Apr 2024 14:37:42 +0530 Subject: [PATCH] fix(hyper.res): prefetch assets instead of preload prefetching assets will cache the resources in prefetch cache and will be available for subsiquient pages, iframes or diff domain which increases the performance in loading time of SDK --- Hyperswitch-React-Demo-App/webpack.dev.js | 2 +- src/orca-loader/Hyper.res | 2 +- webpack.dev.js | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Hyperswitch-React-Demo-App/webpack.dev.js b/Hyperswitch-React-Demo-App/webpack.dev.js index 9368ac4af..e950ece5b 100644 --- a/Hyperswitch-React-Demo-App/webpack.dev.js +++ b/Hyperswitch-React-Demo-App/webpack.dev.js @@ -16,7 +16,7 @@ let devServer = { }, }, headers: { - "Cache-Control": "max-age=31536000,must-revalidate", + "Cache-Control": "must-revalidate", }, }; diff --git a/src/orca-loader/Hyper.res b/src/orca-loader/Hyper.res index 372e194ec..36dc9ae10 100644 --- a/src/orca-loader/Hyper.res +++ b/src/orca-loader/Hyper.res @@ -36,7 +36,7 @@ let preloadFile = (~type_, ~href=``, ()) => { let link = CommonHooks.createElement("link") link.href = href link.\"as" = type_ - link.rel = "preload" + link.rel = "prefetch" link.crossorigin = "anonymous" checkAndAppend(`link[href="${href}"]`, link) } diff --git a/webpack.dev.js b/webpack.dev.js index 1c95cdd1b..8801754f3 100644 --- a/webpack.dev.js +++ b/webpack.dev.js @@ -32,7 +32,7 @@ let devServer = { // }, }, headers: { - "Cache-Control": "max-age=31536000,must-revalidate", + "Cache-Control": "must-revalidate", }, };