def bundle_library(component: Union["Component", str]):
    """Bundle a library with the component.

    Args:
        component: The component to bundle the library with.

    Raises:
        DynamicComponentMissingLibraryError: Raised when a dynamic component is missing a library.
    """
    if isinstance(component, str):
        bundled_libraries.add(component)
        return
    if component.library is None:
        msg = "Component must have a library to bundle."
        raise DynamicComponentMissingLibraryError(msg)
    bundled_libraries.add(format_library_name(component.library))
Bundle a library with the component.

    Args:
        component: The component to bundle the library with.

    Raises:
        DynamicComponentMissingLibraryError: Raised when a dynamic component is missing a library.
    
reflex/components/dynamic.py