From 1dfde1ece85fd63ce443d90d9b682ed8ab905da6 Mon Sep 17 00:00:00 2001 From: ilhan007 Date: Thu, 12 Feb 2026 15:45:21 +0200 Subject: [PATCH] fix(website): use local sandbox URL for playground-elements Always set sandboxBaseUrl to the current origin instead of only in development mode. This makes playground-elements load its resources from local static files instead of unpkg.com CDN. This fixes a runtime error caused by webpack 5.105.0's changed handling of import.meta.url, which broke dynamic imports from external URLs. --- packages/website/src/components/Editor/index.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/packages/website/src/components/Editor/index.js b/packages/website/src/components/Editor/index.js index 0a146c63d269..19cf317cef63 100644 --- a/packages/website/src/components/Editor/index.js +++ b/packages/website/src/components/Editor/index.js @@ -44,9 +44,6 @@ const getProjectFromPool = () => { return projectPool.pop(); } else { const plProject = document.createElement("playground-project"); - if (process.env.NODE_ENV === "development") { - plProject.sandboxBaseUrl = window.location.origin + "/"; - } return plProject; } } @@ -391,6 +388,9 @@ export default function Editor({ html, js, css, mainFile = "main.js", canShare = useEffect(() => { projectRef.current = getProjectFromPool(); + // Always use local static resources instead of unpkg.com CDN + // This avoids issues with webpack's import.meta.url handling + projectRef.current.sandboxBaseUrl = new URL(baseUrl, window.location.origin).href; const activeExample = getActiveExampleContent(); let _html = activeExample.html || html;