-
-
Notifications
You must be signed in to change notification settings - Fork 328
Dynamically Loaded Components cannot work. #1046
-
sample code is follow:
from reactpy import component, run, web
mui = web.module_from_template(
"react@^17.0.0",
"@material-ui/core@4.12.4",
fallback="⌛",
)
Button = web.export(mui, "Button")
@component
def HelloWorld():
return Button({"color": "primary", "variant": "contained"}, "Hello World!")
run(HelloWorld)
error info in browser console:
Failed to load module script: Expected a JavaScript module script but the server responded with a MIME type of "text/plain". Strict MIME type checking is enforced for module scripts per HTML spec.
Beta Was this translation helpful? Give feedback.
All reactions
module_from_template is currently deprecated due to bugs and instability. We will eventually release an alternative to this, but for we recommend using our custom JavaScript components API.
Replies: 2 comments 3 replies
-
Are you on Windows?
Beta Was this translation helpful? Give feedback.
All reactions
-
Also, what backend are you using?
Beta Was this translation helpful? Give feedback.
All reactions
-
^ That information should be shown in the logs when running with reactpy.run
Beta Was this translation helpful? Give feedback.
All reactions
-
👍 1
-
I have the same error message. I use windows 10.
What works for me currently is to change the port.
run(HelloWorld, port=7000)
port 8000, does not work.
I also use this mui, I get it from youtube.
mui = web.module_from_template( "react", "@mui/material", fallback="⌛", )
Sample counter
Beta Was this translation helpful? Give feedback.
All reactions
-
module_from_template is currently deprecated due to bugs and instability. We will eventually release an alternative to this, but for we recommend using our custom JavaScript components API.
Beta Was this translation helpful? Give feedback.
All reactions
-
👍 1