1
votes

Flutter web project works smoothly when running directly into chrome from IDE, but after calling flutter build web, and hosting the built web app is not opening(only a blank page) and showing this error which is

Failed to load resource: the server responded with a status of 404 (Not Found)
main.dart.js:1 

Failed to load resource: the server responded with a status of 404 (Not Found)
(index):1 

Uncaught (in promise) TypeError: Failed to register a ServiceWorker for scope ('http://localhost:8080/') with script ('http://localhost:8080/flutter_service_worker.js'): A bad HTTP response code (404) was received when fetching the script.

enter image description here

1
Did you say you hosted the app? Like on a web server not locally?Tonny Baw
yes I hosted it locallyuser6597752
Okay then i was guessing the issue was due to using "localhost" in the URL but if its still locally hosted then that's not the issue.Tonny Baw

1 Answers

3
votes

Did you publish resources not /build/web but /web?