Comments (7)
Same problem, since yesterday...
We're trying to figure out what's happened
from sandpack.
@theashishmaurya we have forked the repo, made several patches (with pnpm patches) for our needs (so we didn't made PRs) and we're using our CDNs but if we find the error I'll report here for sure.
The weird part is that:
- the SandPack website has the same problem
- we use our CDNs but we have the same error since yesterday. So we probably forgot to move something on our CDNs 🤔
First of all we need to understand WHERE is the issue but currently we have no idea 😅
We'll work on this in the next hours / days
from sandpack.
My bad! I made a silly mistake on the last sandpack version.
It should be fixed in a couple of minutes in the next release version
from sandpack.
Been facing this issue, I am not sure if any one is working on this or not.
from sandpack.
@fabiobiondi I am also looking into this as of now, will share my finding here, if possible try to make a pr with the solution.
from sandpack.
from sandpack.
Sure! Basically, I misplaced the spread operator within the object configuring the Sandpack bundler. This mistake led to an unexpected behavior inside the bundler due to the overwriting of default values.
This caused the error:
this.dispatch({
type: "compile",
// other properties I omitted for now
externalResources: this.options.externalResources || [],
sandboxId: this.options.sandboxId,
...this.options, // 👈
})
The spread operator (...this.options
) was placed after all the property assignments and their defaults. As a result, the new spread overwrote all defaults set above because this.options
also contained externalResources
property and it's very likely that it was undefined
.
Here's two example, one buggy and the another correct:
// 🐞 buggy implementation
const options = {
externalResources: undefined
}
const foo = {
externalResources: options.externalResources || [],
...options
}
foo.externalResources // undefined
And here's the correct implementation, which ensure to keep the default values:
// ✅ Correct
const options = {
externalResources: undefined
}
const foo = {
...options,
externalResources: options.externalResources || [],
}
foo.externalResources // []
Hope it helps!
from sandpack.
Related Issues (20)
- Flickering when switching between files when initMode is "lazy" or "user-visible"
- Module resolution failing due to missing name field in package.json HOT 1
- Not working in localhost
- ReferenceError: self is not defined HOT 1
- Documentation: Output of a code snippet
- SandpackProvider not triggering rerenders when props change on NextJS 13/14 HOT 3
- Scroll Issues in Docs (overflow-anchor)
- Option To Rename A File or A Folder HOT 2
- Allow metadata to be added in the files
- Sandpack not working for ReactJS version 18.2.0 HOT 5
- Service Worker registration failed: TypeError HOT 3
- Prettier code formatting HOT 7
- NextJS Server-side Rendering bug / docs error HOT 4
- CDN install does not work with versions after 2.8.0
- Documentation: SandpackFileExplorer Options display is incorrect
- Update Next.js template and node version to suport next.js app router template HOT 1
- Prioritization error regarding custom style
- Failed to get shell by ID
- Is it possible to load local files HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from sandpack.