我正在尝试将 reactjs 应用程序部署到 aws amplify 并且一切都在本地主机和隐身浏览器窗口中最终运行,就在我在常规浏览器中访问我的应用程序 URL 时,我收到此错误
如果我清除浏览器 cookie 并访问 url 就好了,但是每次我部署一个新的构建文件夹时,它都会回到这个状态。我尝试了几乎所有可以在互联网上找到的建议,但它仍然出现。
我尝试过的解决方案:
<Router basename='/index.html'>
添加到我的代码中。有关我的环境和观察的详细信息:
<html lang="en">
<head>
<meta charset="utf-8" />
<link href="https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;900&display=swap" rel="stylesheet">
<link href="https://fonts.googleapis.com/css?family=Poppins:wght@400;500;600;700;900&display=swap" rel="stylesheet">
<meta name="viewport" content="width=device-width,initial-scale=1" />
<meta name="theme-color" content="#000000" />
<meta name="description" content="Vaccination Verification Made Easy" />
<link rel="apple-touch-icon" href="https://vaxtone.com/logo192.png" />
<link href="//netdna.bootstrapcdn.com/bootstrap/4.1.1/css/bootstrap.min.css" rel="stylesheet" />
<script src="https://js.stripe.com/v3/"></script>
<link rel="manifest" href="https://vaxtone.com/manifest.json" crossorigin="use-credentials">
<title>VaxTone</title>
<link href="https://vaxtone.com/static/css/2.f4136754.chunk.css" rel="stylesheet">
<link href="https://vaxtone.com/static/css/main.dd527d15.chunk.css" rel="stylesheet">
</head>
<body><noscript>You need to enable JavaScript to run this app.</noscript>
<div id="root"></div>
<script>"serviceWorker" in navigator && window.addEventListener("load", (function () { navigator.serviceWorker.register("serviceWorker.js").then((function (e) { console.log("ServiceWorker registration successful with scope: ", e.scope) }), (function (e) { console.log("ServiceWorker registration failed: ", e) })) }))</script>
<script>!function (e) { function t(t) { for (var n, a, i = t[0], c = t[1], l = t[2], s = 0, p = []; s < i.length; s++)a = i[s], Object.prototype.hasOwnProperty.call(o, a) && o[a] && p.push(o[a][0]), o[a] = 0; for (n in c) Object.prototype.hasOwnProperty.call(c, n) && (e[n] = c[n]); for (f && f(t); p.length;)p.shift()(); return u.push.apply(u, l || []), r() } function r() { for (var e, t = 0; t < u.length; t++) { for (var r = u[t], n = !0, i = 1; i < r.length; i++) { var c = r[i]; 0 !== o[c] && (n = !1) } n && (u.splice(t--, 1), e = a(a.s = r[0])) } return e } var n = {}, o = { 1: 0 }, u = []; function a(t) { if (n[t]) return n[t].exports; var r = n[t] = { i: t, l: !1, exports: {} }; return e[t].call(r.exports, r, r.exports, a), r.l = !0, r.exports } a.e = function (e) { var t = [], r = o[e]; if (0 !== r) if (r) t.push(r[2]); else { var n = new Promise((function (t, n) { r = o[e] = [t, n] })); t.push(r[2] = n); var u, i = document.createElement("script"); i.charset = "utf-8", i.timeout = 120, a.nc && i.setAttribute("nonce", a.nc), i.src = function (e) { return a.p + "static/js/" + ({}[e] || e) + "." + { 3: "44b4c37d" }[e] + ".chunk.js" }(e); var c = new Error; u = function (t) { i.onerror = i.onload = null, clearTimeout(l); var r = o[e]; if (0 !== r) { if (r) { var n = t && ("load" === t.type ? "missing" : t.type), u = t && t.target && t.target.src; c.message = "Loading chunk " + e + " failed.\n(" + n + ": " + u + ")", c.name = "ChunkLoadError", c.type = n, c.request = u, r[1](c) } o[e] = void 0 } }; var l = setTimeout((function () { u({ type: "timeout", target: i }) }), 12e4); i.onerror = i.onload = u, document.head.appendChild(i) } return Promise.all(t) }, a.m = e, a.c = n, a.d = function (e, t, r) { a.o(e, t) || Object.defineProperty(e, t, { enumerable: !0, get: r }) }, a.r = function (e) { "undefined" != typeof Symbol && Symbol.toStringTag && Object.defineProperty(e, Symbol.toStringTag, { value: "Module" }), Object.defineProperty(e, "__esModule", { value: !0 }) }, a.t = function (e, t) { if (1 & t && (e = a(e)), 8 & t) return e; if (4 & t && "object" == typeof e && e && e.__esModule) return e; var r = Object.create(null); if (a.r(r), Object.defineProperty(r, "default", { enumerable: !0, value: e }), 2 & t && "string" != typeof e) for (var n in e) a.d(r, n, function (t) { return e[t] }.bind(null, n)); return r }, a.n = function (e) { var t = e && e.__esModule ? function () { return e.default } : function () { return e }; return a.d(t, "a", t), t }, a.o = function (e, t) { return Object.prototype.hasOwnProperty.call(e, t) }, a.p = "https://vaxtone.com/", a.oe = function (e) { throw console.error(e), e }; var i = this["webpackJsonpvaxtone1.0"] = this["webpackJsonpvaxtone1.0"] || [], c = i.push.bind(i); i.push = t, i = i.slice(); for (var l = 0; l < i.length; l++)t(i[l]); var f = c; r() }([])</script>
<script src="https://vaxtone.com/static/js/2.3e8f6948.chunk.js"></script>
<script src="https://vaxtone.com/static/js/main.6ccb123a.chunk.js"></script>
</body>
<style>
body::-webkit-scrollbar {
display: none
}
body {
-ms-overflow-style: none;
scrollbar-width: none
}
</style>
</html>```
5. I used the ```create-react-app``` command to create the reactjs app and use ```npm run build``` to generate the build folder for deployment.
6. I use a service worker to implement progressive-web-app features - could it be something related to my service worker?
Any help on how to resolve this or what do you think is happening would be a big big help .Thanks.