Hacktoberfest 2026: as issues que os mantenedores marcaram para outubro, abertas e boas para iniciantes. Ver issues do Hacktoberfest

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

Aberta
#3,900 3 comentários 0 reações 1 responsável Ver no GitHub

Mantenedores costumam responder em até 2 dias

@T4rk1n já está trabalhando nisso.

Desde 23/7/2026.

Avaliação

Esta issue ainda não foi avaliada.

Descrição

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."

Linguagem predominante
Python
Estrelas
24.4k
Forks
2.3k
Merge médio
2d 5h
PRs com merge (30d)
22

Preparar o ambiente

Primeiros passos

  1. Leia a issue inteira e depois o guia de contribuição do projeto.
  2. Comente na issue dizendo que vai assumir — evita que duas pessoas façam o mesmo trabalho.
  3. Faça um fork do repositório e trabalhe em uma branch.
  4. Abra um pull request que referencie o número da issue.

Mais de plotly/dash

Todas as issues de plotly/dash

Issues semelhantes

Mais issues de Python

Receba novas issues na sua caixa de entrada

Um resumo curto de issues do GitHub para quem está começando.