Feature request: API method to restart project / reinstall dependencies after changing package.json
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 50
- Forks
- 32
- PR merge metrics
- No merged PRs in 30d
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 config
Benefits
- 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
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by tracing the JavaScript SDK's vm.applyFsDiff entry point and the initialization flow it currently does not trigger. Define how dependency installation and dev-server restart should work without destroying the VM session, then verify that package.json changes affect dependencies and configuration without an iframe reload.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript, typescript
- Domain
- api
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100