I've been working on an Angular 10 (now 11, same issue) app and it seems like suddenly the ability to refresh the page or go back is no longer working. I know things don't just suddenly break, and the only thing that I've changed is adding a new "details" component that is supposed to open from a list of records, meaning I've added routing to another component. When I load the app the first time, everything seems fine, and clicking on the record in the list does navigate to the details component. If I try to refresh the page (ie, for debugging) or click the back button, only the raw JSON data from the server loads. No styling at all or other HTML markup. No errors show in the console either and I'm getting a 200 response back from the server, so I guess some JS is still working.
My guess is it's something with routing since that's what I've just added but it's nothing fancy.
const routes: Routes = [
{ path: '', redirectTo: 'customers', pathMatch: 'full' },
{ path: 'customers', component: CustomersListComponent },
{ path: 'customers/:id', component: CustomerDetailComponent }
];
Surely it's some silly Angular config issue but I'm at a loss. I did see this AngularJS post and I checked that just to be sure but my index.html is fine (as far as I can tell):
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>MyApp</title>
<base href="/">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="icon" type="image/x-icon" href="favicon.ico">
<link href="https://fonts.googleapis.com/css?family=Roboto:300,400,500&display=swap" rel="stylesheet">
<link href="https://fonts.googleapis.com/icon?family=Material+Icons" rel="stylesheet">
</head>
<body class="mat-typography">
<app-root></app-root>
</body>
</html>
Anyone want to show me the simple thing I'm missing?
Edit: Also if I retype localhost:4200 manually in the address bar it's fine, but I can't retype localhost:4200/customers. Also tried deleting node_modules, npm update, npm install, and rebooting which seem to have fixed other somewhat similar issues