From d3e933b160c9f847db2b6dc8c84a96af5f632fbd Mon Sep 17 00:00:00 2001 From: "Carlos A. Cabrera" Date: Wed, 27 Nov 2024 09:44:35 -0600 Subject: [PATCH] pre-initialize pdp --- scripts/initializers/pdp.js | 2 ++ scripts/scripts.js | 4 +++- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/scripts/initializers/pdp.js b/scripts/initializers/pdp.js index c68ead8bc..7f5dc688d 100644 --- a/scripts/initializers/pdp.js +++ b/scripts/initializers/pdp.js @@ -1,3 +1,5 @@ +/* eslint import/no-cycle: [2, { maxDepth: 1 }] */ + import { initializers } from '@dropins/tools/initializer.js'; import { initialize, diff --git a/scripts/scripts.js b/scripts/scripts.js index 50f29050b..15fd70081 100644 --- a/scripts/scripts.js +++ b/scripts/scripts.js @@ -185,8 +185,10 @@ async function loadEager(doc) { if (document.body.querySelector('main .product-details')) { pageType = 'Product'; + // initialize pdp + import('./initializers/pdp.js'); + // Preload PDP Dropins assets - preloadFile('/scripts/initializers/pdp.js', 'script'); preloadFile('/scripts/__dropins__/storefront-pdp/api.js', 'script'); preloadFile('/scripts/__dropins__/storefront-pdp/render.js', 'script'); preloadFile('/scripts/__dropins__/storefront-pdp/containers/ProductHeader.js', 'script');