(Docs Update) Using .mjs assets requires explicit mimetype specification
@T4rk1n ya está trabajando en esto.
Desde el 23/7/2026.
Evaluación
Este issue todavía no se ha evaluado.
Descripción
While changing my custom JavaScript files (.js) to modules (.mjs), the browser started complaining of not being able to import the JavaScript assets:
Loading module from “http://localhost/assets/my_js_file.mjs?m=timestamp” was blocked because of a disallowed MIME type (“text/plain”)
The error message holds a clue, but for the uninitiated this is still quite cryptic. After some sparring with the AI and an internet search I found a Dash Forum topic where I posted my issue.
The solution that makes the module files be accepted is to explicitly add the MIME type for module files (before starting the server).
import mimetypes
mimetypes.add_type("application/javascript", ".mjs")
@BSd3v was helpful in replying that this is expected behavior, while I was left confused that I could not find any reference to this requirement when using .mjs files, see the Dash docs on static assets.
So now stands the question: Is this indeed the expected solution? Why is this suggestion not readily found online? Even in the example of AnnMarie in the linked Dash Forum post, this MIME type definition is not used. If it is expected, should the docs include a hint to this requirement. Something like: "If the browser shows this error, then your Python doesn't correctly MIME type mjs files. Add this explicit definition to fix your system."
- Lenguaje dominante
- Python
- Estrellas
- 24.4k
- Forks
- 2.3k
- Merge medio
- 1 d 21 h
- PR fusionados (30 d)
- 19
Guía de contribución
Primeros pasos
- Lee el issue completo y luego la guía de contribución del proyecto.
- Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
- Haz un fork del repositorio y trabaja en una rama.
- Abre un pull request que haga referencia al número del issue.
Más de plotly/dash
-
good first issue P3 size: 1 task
Dificultad 2/5 1-3 horas Aptitud para principiantes 68/100
-
enhancement P2 size: 5
Dificultad 5/5 Más de una semana Aptitud para principiantes 45/100
-
enhancement P3 size: 10+
-
P2 size: 1 task
-
enhancement P3 size: 1
Dificultad 3/5 1-2 días Aptitud para principiantes 72/100
Todos los issues de plotly/dash
Issues similares
-
essnmx good first issue
Dificultad 1/5 Menos de una hora Aptitud para principiantes 95/100
-
[Feature] 奇物选择添加优先级 Abierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 65/100
syfoud/Simulated_Scepter#174 ·
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 75/100
Giskard-AI/giskard-oss#2840 · 1 comentario ·
-
A claim comment carrying the issue number is silently declined while the workflow reports success Abiertoarea: repo bug perceived difficulty: 2
Dificultad 2/5 1-3 horas Aptitud para principiantes 70/100
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 75/100
yeti-platform/yeti#1380 ·