Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Dynamically Loaded Components cannot work. #1046

Discussion options

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.
You must be logged in to vote

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

Comment options

Are you on Windows?

You must be logged in to vote
2 replies
Comment options

Also, what backend are you using?

Comment options

^ That information should be shown in the logs when running with reactpy.run

Comment options

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

image

You must be logged in to vote
1 reply
Comment options

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.

Answer selected by Archmonger
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

AltStyle によって変換されたページ (->オリジナル) /