include emotion react for dynamic components
This commit is contained in:
parent
e0580eb9cb
commit
c85b477325
@ -26,7 +26,11 @@ 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 = {"react", "@radix-ui/themes"}
|
bundled_libraries = {
|
||||||
|
"react",
|
||||||
|
"@radix-ui/themes",
|
||||||
|
"@emotion/react",
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
def bundle_library(component: "Component"):
|
def bundle_library(component: "Component"):
|
||||||
@ -127,7 +131,10 @@ def load_dynamic_serializer():
|
|||||||
|
|
||||||
module_code_lines.insert(0, "const React = window.__reflex.react;")
|
module_code_lines.insert(0, "const React = window.__reflex.react;")
|
||||||
|
|
||||||
return "//__reflex_evaluate\n" + "\n".join(module_code_lines)
|
return (
|
||||||
|
"//__reflex_evaluate\n/** @jsx jsx */\nconst { jsx } = window.__reflex['@emotion/react']\n"
|
||||||
|
+ "\n".join(module_code_lines)
|
||||||
|
)
|
||||||
|
|
||||||
@transform
|
@transform
|
||||||
def evaluate_component(js_string: Var[str]) -> Var[Component]:
|
def evaluate_component(js_string: Var[str]) -> Var[Component]:
|
||||||
|
Loading…
Reference in New Issue
Block a user