codesandbox/sandpack

Static template does not work in CDN install

Liombe opened this issue · 0 comments

Bug report

Packages affected

  • sandpack-react

Description of the problem

Static template does not work in CDN install

What were you doing when the problem occurred?

What steps can we take to reproduce the problem?

Load this HTML file

<!DOCTYPE html>
<html>
  <head>
    <meta charset="UTF-8" />
 
    <script type="importmap">
      {
        "imports": {
          "react": "https://esm.sh/react@18.2.0",
          "react-dom": "https://esm.sh/react-dom@18.2.0",
          "react-dom/": "https://esm.sh/react-dom@18.2.0/",
          "@codesandbox/sandpack-react": "https://esm.sh/@codesandbox/sandpack-react@2.11.3",
          "@codesandbox/sandpack-themes": "https://esm.sh/@codesandbox/sandpack-themes@2.0.21",
        }
      }
    </script>
 
    <script type="module">
      import React from "react";
      import { createRoot } from "react-dom/client";
      import { Sandpack } from "@codesandbox/sandpack-react";
      import { nightOwl } from "@codesandbox/sandpack-themes";
 
      const root = createRoot(document.getElementById("root"));
      const sandpackComponent = React.createElement(
        Sandpack,
        { template: "static", theme: nightOwl, options: { showConsole: true, showConsoleButton: true } },
        null
      );
      root.render(sandpackComponent);
    </script>
  </head>
 
  <body>
    <div id="root"></div>
  </body>
</html>

Preview does not load and you can read some errors in console

console screenshot

Link to sandbox: link (optional)

Your Environment

Software Name/Version
Sandpack-client version x
Sandpack-react version 2.11.3
Browser Chrome 120.0.6099.225
Operating System Windows 10