Skip to content

Including a library, that builds on React, in a remote results into "Cannot read properties of null (reading 'useRef')" #534

@pganster

Description

@pganster

Versions

  • vite-plugin-federation: 1.3.2
  • vite: 4.0.5

Reproduction

Essentially I just cloned your react-vite example and added the react-image-gallery library in the remote app. When opening the remote app directly, the gallery is shown as expected. BUT if you open the host app, you will get the error Cannot read properties of null (reading 'useRef').

Steps to reproduce

  1. Clone this reproduction repository.
  2. In root, call pnpm install && pnpm run build && pnpm run serve
  3. Open localhost:5000
  4. See the error

When opening localhost:5001, the error does not occur.

What is Expected?

No error to occur when opening the host app.

What is actually happening?

The error Cannot read properties of null (reading 'useRef') occurring and breaking the host and remote app.

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