Skip to content

Commit cb40927

Browse files
committed
fix: make default "template" value to undefined
1 parent f89a996 commit cb40927

2 files changed

Lines changed: 10 additions & 3 deletions

File tree

public/README.md

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,11 @@ Open editor at first.
3636
<!-- sandpack:{
3737
"files": {
3838
"/src/index.js": {
39-
"appendCode": "// 次の行は本編とは無関係のコードなので無視してください\nconst link = document.createElement('link');link.rel='stylesheet';link.href='https://jsprimer.net/use-case/todoapp/final/final/index.css';document.head.append(link);\n",
39+
"code": "// This is auto generated by vanilla template",
40+
"hidden": true
41+
},
42+
"/src/index2.js": {
43+
"appendCode": "// Hack to load css\nconst link = document.createElement('link');link.rel='stylesheet';link.href='https://jsprimer.net/use-case/todoapp/final/final/index.css';document.head.append(link);\n",
4044
"path": "example2/src/index.js"
4145
},
4246
"/src/App.js": {
@@ -51,7 +55,10 @@ Open editor at first.
5155
"path": "example2/index.html"
5256
}
5357
},
58+
"entry": "/src/index2.js",
59+
"main": "/src/index2.js",
5460
"environment": "static",
61+
"template": "vanilla",
5562
"options": {
5663
"showLineNumbers": true,
5764
"showInlineErrors": true,

src/sandpack.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ export type SandboxOptions = {
2929
/**
3030
* What template we use, if not defined we infer the template from the dependencies or files.
3131
*/
32-
template?: string;
32+
template?: SandpackPredefinedTemplate;
3333
options?: Record<string, any>; // Refer SandpackInternalProps
3434
honkitSettings?: {
3535
isOpen: boolean; // false by default
@@ -115,7 +115,7 @@ export const attachToElement = (element: HTMLElement | ChildNode, options: Sandb
115115
};
116116
const entry = options.entry;
117117
const sandpackOptions = options.options;
118-
const template = (options.template ?? "vanilla") as SandpackPredefinedTemplate;
118+
const template = options.template;
119119
currentRoot.render(
120120
<Sandpack
121121
files={files}

0 commit comments

Comments
 (0)