#getting a "Cannot GET /{route} " message

1 messages · Page 1 of 1 (latest)

sharp oxide
#

I get this message on running my project build(post npm run build) through a Lighthouse audit or when i try to navigate to different routes using links in a page or if i manually enter a route in the url, along with a 404(Not Found) in the console
What could be the issue?

Here's the vite config:
export default defineConfig({
plugins: [
react(),
// compression(),
compression({
algorithm: "brotliCompress",
exclude: [/.(br)$/, /.(gz)$/],
deleteOriginalAssets: false,
}),
splitVendorChunkPlugin(),
],
build: {
outDir: "../../builds/Project",
minify: true,
rollupOptions: {
output: {
globals: {
react: "React",
},
manualChunks: (id: string) => {
if (id.includes("react")) {
return "@react";
}
if (id.includes("react-router-dom") || id.includes("react-router")) {
return "@react-router";
}
if (id.includes("framer-motion")) {
return "@framer-motion";
}
},
},
},
},
});

broken thistle
#

where are you hosting? you need to redirect /(.*) to /index.html so that SPA navigation kicks in

sharp oxide
#

I haven't hosted it yet, I want to run the build via live server for final audits before deploying it, how do I do what you just said?

broken thistle
#

Ah, the local preview server doesn't support brotli I think