The relative Vite base made BrowserRouter pages request JavaScript and CSS under /auth/assets. The SPA fallback returned index.html for those paths, so the browser never mounted React and the sign-in page appeared blank. Emit root-relative asset URLs so every client-side route loads the embedded console bundle.
This commit is contained in:
1 parent
2348d2e4b4
commit
52ec290055
2 files changed
+8
-4
No files matched your search
Vendored
+3
-3
@@ -2,11 +2,11 @@
|
|||||||
<html lang="en">
|
<html lang="en">
|
||||||
<head>
|
<head>
|
||||||
<meta charset="UTF-8" />
|
<meta charset="UTF-8" />
|
||||||
<link rel="icon" type="image/svg+xml" href="./favicon.svg" />
|
<link rel="icon" type="image/svg+xml" href="/favicon.svg" />
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||||
<title>web</title>
|
<title>web</title>
|
||||||
<script type="module" crossorigin src="./assets/index-Dh5C0Ucn.js"></script>
|
<script type="module" crossorigin src="/assets/index-D_F84V7q.js"></script>
|
||||||
<link rel="stylesheet" crossorigin href="./assets/index-CZ8p4VMZ.css">
|
<link rel="stylesheet" crossorigin href="/assets/index-CZ8p4VMZ.css">
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
<div id="root"></div>
|
<div id="root"></div>
|
||||||
|
|||||||
+5
-1
@@ -6,7 +6,11 @@ import { defineConfig } from 'vite'
|
|||||||
// the app always talks to a relative `/api` base. During development Vite
|
// the app always talks to a relative `/api` base. During development Vite
|
||||||
// proxies that prefix to a locally running fancy-dns.
|
// proxies that prefix to a locally running fancy-dns.
|
||||||
export default defineConfig({
|
export default defineConfig({
|
||||||
base: './',
|
// BrowserRouter routes such as /auth/login are served by the SPA fallback.
|
||||||
|
// A relative base makes their asset URLs resolve under /auth/assets, which
|
||||||
|
// the fallback answers with index.html and leaves the page blank. Rooted
|
||||||
|
// URLs keep assets and API calls on the application origin at every route.
|
||||||
|
base: '/',
|
||||||
plugins: [react(), tailwindcss()],
|
plugins: [react(), tailwindcss()],
|
||||||
server: {
|
server: {
|
||||||
proxy: {
|
proxy: {
|
||||||
|
|||||||
Reference in new issue
Block a user