You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Sandpack examples with index.html files throw runtime errors #6487
The issue seems to be because the index.html files defined in these examples are not used, instead, the public/index.html defined in the template are used
This breaks examples that use index.html for instance because the merging of objects here results in the template file being used because the given public/index.html has been given the path /src/public/index.html
Activity
fix(sandpack-template): use custom react sandpack template (#6484)
geeseyj commentedon Dec 15, 2023
Taking a look at this.
geeseyj commentedon Dec 15, 2023
I opened a PR to revert the breaking change.
The cause is the assumption here that all files within a sandpack example should be nested into a
srcdirectory.react.dev/src/components/MDX/Sandpack/createFileMap.ts
Lines 7 to 12 in e3c25d1
react.dev/src/components/MDX/Sandpack/createFileMap.ts
Line 30 in e3c25d1
This breaks examples that use
index.htmlfor instance because the merging of objects here results in the template file being used because the givenpublic/index.htmlhas been given the path/src/public/index.htmlreact.dev/src/components/MDX/Sandpack/SandpackRoot.tsx
Line 82 in e3c25d1
That gives us a couple options for a solution.
createFileMapknow (arguably) too much by giving it a "whitelist" of file paths to not nest in a/src/directory.At this point unfortunately I think option 2 is the un-sexy, more-correct option.
Fix reactjs#6487 specify which `Sandpack` files go into a `src` direc…