bundle next link in window (#4064)
This commit is contained in:
parent
edd17208c0
commit
47230198bb
@ -1,6 +1,6 @@
|
|||||||
"""Components that are dynamically generated on the backend."""
|
"""Components that are dynamically generated on the backend."""
|
||||||
|
|
||||||
from typing import TYPE_CHECKING
|
from typing import TYPE_CHECKING, Union
|
||||||
|
|
||||||
from reflex import constants
|
from reflex import constants
|
||||||
from reflex.utils import imports
|
from reflex.utils import imports
|
||||||
@ -26,14 +26,10 @@ def get_cdn_url(lib: str) -> str:
|
|||||||
return f"https://cdn.jsdelivr.net/npm/{lib}" + "/+esm"
|
return f"https://cdn.jsdelivr.net/npm/{lib}" + "/+esm"
|
||||||
|
|
||||||
|
|
||||||
bundled_libraries = {
|
bundled_libraries = {"react", "@radix-ui/themes", "@emotion/react", "next/link"}
|
||||||
"react",
|
|
||||||
"@radix-ui/themes",
|
|
||||||
"@emotion/react",
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
def bundle_library(component: "Component"):
|
def bundle_library(component: Union["Component", str]):
|
||||||
"""Bundle a library with the component.
|
"""Bundle a library with the component.
|
||||||
|
|
||||||
Args:
|
Args:
|
||||||
@ -42,6 +38,9 @@ def bundle_library(component: "Component"):
|
|||||||
Raises:
|
Raises:
|
||||||
DynamicComponentMissingLibrary: Raised when a dynamic component is missing a library.
|
DynamicComponentMissingLibrary: Raised when a dynamic component is missing a library.
|
||||||
"""
|
"""
|
||||||
|
if isinstance(component, str):
|
||||||
|
bundled_libraries.add(component)
|
||||||
|
return
|
||||||
if component.library is None:
|
if component.library is None:
|
||||||
raise DynamicComponentMissingLibrary("Component must have a library to bundle.")
|
raise DynamicComponentMissingLibrary("Component must have a library to bundle.")
|
||||||
bundled_libraries.add(format_library_name(component.library))
|
bundled_libraries.add(format_library_name(component.library))
|
||||||
|
Loading…
Reference in New Issue
Block a user