Files
klz-cables.com/.pnpm-store/v10/files/d6/f5c2171a1720743f924d3ac2937489c006a4a8f042b5ddd15c9f5d298cf16e433493cb947feb8b1cb5860a57503fffc9e11b64519e2f9aa84d83e3542189f0
Marc Mintel 5397309103
Some checks failed
Build & Deploy / 🔍 Prepare (push) Successful in 20s
Build & Deploy / 🧪 QA (push) Failing after 34s
Build & Deploy / 🏗️ Build (push) Has started running
Build & Deploy / 🚀 Deploy (push) Has been cancelled
Build & Deploy / 🧪 Smoke Test (push) Has been cancelled
Build & Deploy / ⚡ Lighthouse (push) Has been cancelled
Build & Deploy / 🔔 Notify (push) Has been cancelled
fix(products): fix breadcrumbs and product filtering (backport from main)
2026-02-24 16:04:21 +01:00

1 line
1.9 KiB
Plaintext

{"version":3,"sources":["../../src/utilities/dynamicImport.ts"],"sourcesContent":["import path from 'path'\nimport { pathToFileURL } from 'url'\n\n/**\n * Dynamically imports a module from a file path or module specifier.\n *\n * Uses a direct `import()` in Vitest (where eval'd imports fail with ERR_VM_DYNAMIC_IMPORT_CALLBACK_MISSING),\n * and `eval(`import(...)`)` elsewhere to hide the import from Next.js bundler static analysis.\n *\n * @param modulePathOrSpecifier - Either an absolute file path or a module specifier (package name)\n */\nexport async function dynamicImport<T = unknown>(modulePathOrSpecifier: string): Promise<T> {\n // Convert absolute file paths to file:// URLs, but leave package specifiers as-is\n const importPath = path.isAbsolute(modulePathOrSpecifier)\n ? pathToFileURL(modulePathOrSpecifier).href\n : modulePathOrSpecifier\n\n // Vitest runs tests in a VM context where eval'd dynamic imports fail with\n // ERR_VM_DYNAMIC_IMPORT_CALLBACK_MISSING. Use direct import in test environment.\n if (process.env.VITEST) {\n return await import(/* webpackIgnore: true */ importPath)\n }\n\n // Without the eval, the Next.js bundler will throw this error when encountering the import statement:\n // ⚠ Compiled with warnings in X.Xs\n // Critical dependency: the request of a dependency is an expression\n return await eval(`import('${importPath}')`)\n}\n"],"names":["path","pathToFileURL","dynamicImport","modulePathOrSpecifier","importPath","isAbsolute","href","process","env","VITEST","eval"],"mappings":"AAAA,OAAOA,UAAU,OAAM;AACvB,SAASC,aAAa,QAAQ,MAAK;AAEnC;;;;;;;CAOC,GACD,OAAO,eAAeC,cAA2BC,qBAA6B;IAC5E,kFAAkF;IAClF,MAAMC,aAAaJ,KAAKK,UAAU,CAACF,yBAC/BF,cAAcE,uBAAuBG,IAAI,GACzCH;IAEJ,2EAA2E;IAC3E,iFAAiF;IACjF,IAAII,QAAQC,GAAG,CAACC,MAAM,EAAE;QACtB,OAAO,MAAM,MAAM,CAAC,uBAAuB,GAAGL;IAChD;IAEA,sGAAsG;IACtG,mCAAmC;IACnC,oEAAoE;IACpE,OAAO,MAAMM,KAAK,CAAC,QAAQ,EAAEN,WAAW,EAAE,CAAC;AAC7C"}