diff --git a/sandpack-client/src/clients/runtime/types.ts b/sandpack-client/src/clients/runtime/types.ts
index 2d9a1d09c..f47bebff3 100644
--- a/sandpack-client/src/clients/runtime/types.ts
+++ b/sandpack-client/src/clients/runtime/types.ts
@@ -106,4 +106,19 @@ export type SandpackRuntimeMessage = BaseSandpackMessage &
| SandboxTestMessage
| { type: "sign-in"; teamId: string }
| { type: "sign-out" }
+ | {
+ type: "dependencies";
+ data:
+ | {
+ state: "downloading_manifest";
+ }
+ | {
+ state: "downloaded_module";
+ name: string;
+ totalPending: number;
+ }
+ | {
+ state: "starting";
+ };
+ }
);
diff --git a/sandpack-react/src/Playground.stories.tsx b/sandpack-react/src/Playground.stories.tsx
index 7e73a1760..59a581eba 100644
--- a/sandpack-react/src/Playground.stories.tsx
+++ b/sandpack-react/src/Playground.stories.tsx
@@ -11,30 +11,20 @@ export const Basic: React.FC = () => {
return (
Hedy Lamarr's Todos
-
-
- - Invent new traffic lights
-
- Rehearse a movie scene
-
- Improve spectrum technology
-
- );
- }
- `,
- }}
options={{
- initMode: "user-visible",
- bundlerURL: "https://786946de.sandpack-bundler-4bw.pages.dev",
+ bundlerURL: "https://ymxnqs-3000.csb.app",
}}
template="react"
+ customSetup={{
+ dependencies: {
+ "react-content-loader": "latest",
+ "radix-ui": "latest",
+ "styled-components": "latest",
+ "react-dom": "latest",
+ react: "latest",
+ "react-table": "latest",
+ },
+ }}
/>
);
diff --git a/sandpack-react/src/hooks/useSandpackPreviewProgress.ts b/sandpack-react/src/hooks/useSandpackPreviewProgress.ts
index ad2a39f0d..972809a06 100644
--- a/sandpack-react/src/hooks/useSandpackPreviewProgress.ts
+++ b/sandpack-react/src/hooks/useSandpackPreviewProgress.ts
@@ -56,7 +56,22 @@ export const useSandpackPreviewProgress = (
}, timeout);
}
- if (message.type === "shell/progress" && !isReady) {
+ if (message.type === "dependencies") {
+ setLoadingMessage(() => {
+ switch (message.data.state) {
+ case "downloading_manifest":
+ return "[1/3] Downloading manifest";
+
+ case "downloaded_module":
+ return `[2/3] Downloaded ${message.data.name} (${message.data.progress}/${message.data.total})`;
+
+ case "starting":
+ return "[3/3] Starting";
+ }
+
+ return null;
+ });
+ } else if (message.type === "shell/progress" && !isReady) {
if (!totalDependencies && message.data.state === "downloaded_module") {
setTotalDependencies(message.data.totalPending);
}