codesandbox/sandpack

CDN install does not work with versions after 2.8.0

Opened this issue · 0 comments

Bug report

Packages affected

  • sandpack-client
  • sandpack-react

Description of the problem

I have followed the docs on how to install sandbox from a CDN. It works fine with the version specified in the docs (2.8.0), but it fails with any newer version.

The latest version (2.13.2) fails with the following error:

Uncaught TypeError: o is undefined
    h https://esm.sh/v135/@lezer/lr@1.3.14/es2022/lr.mjs:3
    l https://esm.sh/v135/@lezer/lr@1.3.14/es2022/lr.mjs:3
    deserialize https://esm.sh/v135/@lezer/lr@1.3.14/es2022/lr.mjs:3
    <anonymous> https://esm.sh/v135/@lezer/html@1.3.8/es2022/html.mjs:2
lr.mjs:3:21968

What were you doing when the problem occurred?

Loading the page.

What steps can we take to reproduce the problem?

Open this html file:

<!DOCTYPE html>
<html lang="en">
  <head>
    <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.13.2"
        }
      }
    </script>
    <script type="module">
      import React from "react";
      import { createRoot } from "react-dom/client";
      import { Sandpack } from "@codesandbox/sandpack-react";

      const rootElement = document.getElementById("root");
      const root = createRoot(rootElement);
      const sandpackComponent = React.createElement(Sandpack, {
        template: "vanilla",
      });
      root.render(sandpackComponent);
    </script>
  </head>
  <body>
    <div id="root"></div>
  </body>
</html>

Link to sandbox

https://codesandbox.io/p/sandbox/sandpack-bug-repro-53trm3

Your Environment

Software Name/Version
Sandpack-client version
Sandpack-react version 2.13.2
Browser Firefox 123.0
Operating System macOS 14.1.2