Hacktoberfest 2026: los issues que los mantenedores marcaron para octubre, abiertos y aptos para principiantes. Explorar issues de Hacktoberfest

(Docs Update) Using .mjs assets requires explicit mimetype specification

Abierto
#3,900 3 comentarios 0 reacciones 1 asignado Ver en GitHub

@T4rk1n ya está trabajando en esto.

Desde el 23/7/2026.

Evaluación

Este issue todavía no se ha evaluado.

Descripción

P3 size: 1 task

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

Abrir la guía de contribución

Primeros pasos

  1. Lee el issue completo y luego la guía de contribución del proyecto.
  2. Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
  3. Haz un fork del repositorio y trabaja en una rama.
  4. Abre un pull request que haga referencia al número del issue.

Más de plotly/dash

Todos los issues de plotly/dash

Issues similares

Más issues de Python

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.