Hacktoberfest 2026: những issue maintainer đã đánh dấu cho tháng Mười, đang mở và phù hợp người mới. Xem issue Hacktoberfest

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

Đang mở
#3,900 3 bình luận 0 reaction 1 người được giao Xem trên GitHub

@T4rk1n đang làm issue này rồi.

Từ ngày 23/7/2026.

Đánh giá

Issue này chưa được đánh giá.

Mô tả

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

Ngôn ngữ chính
Python
Star
24.4k
Fork
2.3k
Merge trung bình
1 ngày 19 giờ
Pull request đã merge (30 ngày)
19

Hướng dẫn đóng góp

Mở hướng dẫn đóng góp

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của plotly/dash

Tất cả issue của plotly/dash

Issue tương tự

Thêm issue về Python

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.