Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Static template does not work in CDN install #1066

Open
1 task done
Liombe opened this issue Jan 23, 2024 · 0 comments
Open
1 task done

Static template does not work in CDN install #1066

Liombe opened this issue Jan 23, 2024 · 0 comments
Labels
bug Something isn't working triage New issues that needs consideration

Comments

@Liombe
Copy link

Liombe commented Jan 23, 2024

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
@Liombe Liombe added bug Something isn't working triage New issues that needs consideration labels Jan 23, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working triage New issues that needs consideration
Projects
None yet
Development

No branches or pull requests

1 participant