Static template does not work in CDN install
Liombe opened this issue · 0 comments
Liombe commented
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](https://private-user-images.githubusercontent.com/16174252/298846511-860d7a75-36a7-4888-b56b-b6ad64fc80ef.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MDk4NTQ3MzYsIm5iZiI6MTcwOTg1NDQzNiwicGF0aCI6Ii8xNjE3NDI1Mi8yOTg4NDY1MTEtODYwZDdhNzUtMzZhNy00ODg4LWI1NmItYjZhZDY0ZmM4MGVmLnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNDAzMDclMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjQwMzA3VDIzMzM1NlomWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPTRhMjdkZTQ0NjM2YzFlYTBmYjJlYTU4MmFlMjg4YzJhMGY3ZDQyOWI5NWVkNTUzMTQ2ZTQwZmY3MzFlYTE4ZDImWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0JmFjdG9yX2lkPTAma2V5X2lkPTAmcmVwb19pZD0wIn0.zQshTKM0Utgml4RJqDIzxGjCp41E-lKmYmBCSSEgzmI)
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 |