I've tried to deploy my web app but when I go the the public adress, I have some errors that i can't fix. (I'm testing on Firefox). I've asked my developper friends but they have no idea how to solve it.
my errors:
The script was loaded when its MIME type ("text / html") is not a valid JavaScript MIME type.
Uncaught SyntaxError: expected expression, got '<' main.dart.js:1
my index.html:
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>MyAwesomeWebApp</title>
<!-- Favicon -->
<link rel="icon" type="image/png" href="favicon.png"/>
<link rel="manifest" href="manifest.json"/>
</head>
<body>
<script type="application/javascript" src="//cdnjs.cloudflare.com/ajax/libs/pdf.js/2.4.456/pdf.min.js"></script>
<script type="application/javascript">
pdfjsLib.GlobalWorkerOptions.workerSrc = "//cdnjs.cloudflare.com/ajax/libs/pdf.js/2.4.456/pdf.worker.min.js";
</script>
<script type="application/javascript" src="https://www.gstatic.com/firebasejs/7.14.0/firebase-app.js"></script>
<script type="application/javascript" src="https://www.gstatic.com/firebasejs/7.14.0/firebase-analytics.js"></script>
<script type="application/javascript" src="https://www.gstatic.com/firebasejs/7.14.0/firebase-firestore.js"></script>
<script type="application/javascript" src="https://www.gstatic.com/firebasejs/7.14.0/firebase-auth.js"></script>
<script type="application/javascript" src="https://www.gstatic.com/firebasejs/7.14.0/firebase-storage.js"></script>
<script>
var firebaseConfig = {
apiKey: "azaz",
authDomain: "azaz",
databaseURL: "azaz",
projectId: "azaz",
storageBucket: "azaz",
messagingSenderId: "azaz",
appId: "azaz",
measurementId: "azaz"
};
firebase.initializeApp(firebaseConfig);
</script>
<script>
if ('serviceWorker' in navigator) {
window.addEventListener('flutter-first-frame', function () {
navigator.serviceWorker.register('flutter_service_worker.js?v=906927181');
});
}
</script>
<script src="main.dart.js" type="application/javascript"></script>
</body>
</html>
Thanks ! :D
did you deploy using firebase deploy
or firebase deploy --only hosting
?
I had the same issue using the first one. With the second one, no more issue.
You can learn more about this on the firebase documentation: https://firebase.google.com/docs/hosting/test-preview-deploy
Hope it'll be helpful !