[Python] Flutter web build release shows white screen

Discussão em 'Python' iniciado por Stack, Abril 28, 2025.

  1. Stack

    Stack Membro Participativo

    First i run flutter build web --release in the same location that my pubspec.yaml is, once it is build i do cd build/web and then I start a http server with python -m http.server 5000. The webpage shows a blank white screen. Then I checked the logs in dev tools and saw these errors:

    [​IMG]

    The script has an unsupported MIME type ('text/plain'). and localhost/:1 Uncaught (in promise) DOMException: Failed to register a ServiceWorker for scope ('http://localhost:5000/') with script ('http://localhost:5000/flutter_service_worker.js?v=3443120066'): The script has an unsupported MIME type ('text/plain'). are the errors I encounter. How do I fix this?

    Here is the console logs from the python server:

    Serving HTTP on :: port 5000 (http://[::]:5000/) ...
    ::1 - - [30/Jul/2022 01:01:58] "GET / HTTP/1.1" 304 -
    ::1 - - [30/Jul/2022 01:01:58] "GET /flutter.js HTTP/1.1" 304 -
    ::1 - - [30/Jul/2022 01:01:59] code 404, message File not found
    ::1 - - [30/Jul/2022 01:01:59] "GET /requestProvider.js.map HTTP/1.1" 404 -
    ::1 - - [30/Jul/2022 01:01:59] "GET /flutter_service_worker.js?v=3443120066 HTTP/1.1" 200 -
    ::1 - - [30/Jul/2022 01:02:03] "GET /main.dart.js HTTP/1.1" 304 -
    ::1 - - [30/Jul/2022 01:02:03] "GET /main.dart.js.map HTTP/1.1" 200 -
    ::1 - - [30/Jul/2022 01:02:04] code 404, message File not found
    ::1 - - [30/Jul/2022 01:02:04] "GET /main.dart HTTP/1.1" 404 -

    Continue reading...

Compartilhe esta Página