-
Notifications
You must be signed in to change notification settings - Fork 26
Open
Description
Description
Currently, when using the JavaScript SDK’s vm.applyFsDiff to modify package.json, the changes are written to the file system but do not trigger dependency installation or restart the dev server. This means:
- Newly added dependencies are not installed until the entire embed is reloaded.
- Changes to
scripts,startCommand, or other config have no effect until reload. - The only workaround is to reload the iframe, which resets runtime state and is disruptive.
Live example
https://mkucmus.github.io/scoped-template-launcher/?branch=main
- template launcher alters the package.json via
vm.applyFsDiffmethod for corresponding project viaembedGithubProject - stackblitz does not detect the change and the packages aren't installed
Proposed solution
Introduce an API method in the SDK that allows developers to programmatically re-run the initialization flow after changes to package.json, without destroying the VM session. For example:
await vm.installDependencies(); // installs based on current package.json
await vm.restart(); // restarts dev server with updated configBenefits
- Smoother UX for dynamic demos where dependencies or commands change on the fly
- No need to reload iframe → preserves state
- Consistent with how StackBlitz handles
package.jsonon initial project load
Example use cases
- Adding a dependency on user action (e.g., “Add Tailwind CSS” button in a tutorial)
- Switching between example setups with different dependency sets
- Editing
startCommandor build config dynamically
References
- applyFsDiff docs — allows editing files but no restart behavior
- Project config docs — configuration is only applied on initial load
Metadata
Metadata
Assignees
Labels
No labels