prerendering material-ui components

Author: sternjCreated Dec 23, 2021Updated Sep 25, 2023

I have been attempting to perform server-side rendering of mui (formerly material-ui) components and have been getting issues similar to #193. The precise error I am getting is

ActionView::Template::Error (Encountered error "#<ExecJS::ProgramError: Error: Element type is invalid: expected a string (for built-in components) or a class/function (for composite components) but got: undefined. You likely forgot to export your component from the file it's defined in, or you might have mixed up default and named imports.>" when prerendering MaterialComponentList with {}

I was wondering whether the state of the art has changed with regards to using server-side rendering. For the sake of example, I am using a modified form of this in this gist

I'm on rails 6.1.4.4 with Ruby 3.0 and reasct-rails 2.6.1.

If it would be helpful I can spin up and post a minimal example.