Skip to content

Method of disabling multiple instances warning #2549

Open

Description

@benmccann

I'm getting the warning:

You appear to have multiple instances of Solid. This can lead to unexpected behavior.

I don't think there's actually any issue in my case. The two instances/components don't share any common root and I don't want them to interact in any way. Also, one of the instances is present only in development, so I'm not worried about extra bytes being shipped to production because of an extra copy.

I would love if there were some way to disable this warning since I don't think it's actually a problem in my case.

Activity

  1. ryansolid commented on Oct 23, 2025

    @ryansolid
    Member

    Hmm.. Yeah majority time this happens because someone packages a version of Solid with a library and then we get things not reacting. This happened enough times that we added the warning.

    But if completely isolated, I suppose there wouldn't be any collisions. Disabling it is interesting though since it is basically a global check on import, so there is no configuration that happens before it. I wonder if we can bypass the check by setting a global before import. Seems hacky but I'm not sure how else to bypass it in time. Or what other sort of check we could do that would accomplish the same.

  2. ryansolid commented on Oct 27, 2025

    @ryansolid
    Member

    I'm really struggling with this one because I'm trying to think of a way to do this so that some 3rd party tool doesn't just turn off the check for everyone. It's one thing to say hey my thing doesn't care, but if say this is like used in some devtools and it turns off the check then people won't realize when a different library has this issue.

    We need to think of something else in terms of the check. A unique symbol per module that gets set/checked in the render call optionally might be an option. But that comes from solid-js/web not core so in a sense doesn't guarantee what we need. But maybe something else along this vein?..

  3. benmccann commented on Dec 17, 2025

    @benmccann
    Author

    It looks like it's coming from here:

    if (IS_DEV && globalThis) {

    Perhaps this line could be changed to something like:

    if (IS_DEV && globalThis && !__UNSHARED__) {

    Folks who are using a bundler could then replace the value at build-time. E.g. with Vite:

    export default defineConfig({
      define: {
        __UNSHARED__: true
      },
    });
  4. ryansolid commented on Feb 23, 2026

    @ryansolid
    Member

    Oh hey, just saw you responded. Wouldn't that break any unbundled builds though as it is undefined? I guess maybe it depends on the runtime.

    Hmm.. expose it and it becomes global, compile it requires all down stream tooling to play along. This is tricky.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions