Skip to content

Handling multiple initialisation #1914

@pranavmappoli

Description

@pranavmappoli

I'm working on a use case where users can switch between different project templates—for example, starting with React (which installs its dependencies), and later switching to something like Next.js.

The issue I'm facing is that once dependencies for one framework are installed, switching to another doesn't clean up the previous environment, causing the WebContainer to grow in size and behave inconsistently.

I tried using webContainer.teardown(), but it doesn't seem to fully reinitialize the container. I'm looking for a clean way to reset or reinitialize the entire WebContainer instance so that switching between stacks (like React → Next.js → Vue, etc.) is fully isolated each time.

Question:
How are you handling this kind of scenario in your setup? Is there a reliable way to reset WebContainer to a clean state?

Thanks in advance!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions