angular/angular-cli

ng serve fails to load app if url parameter contains a dot (.)

MurmursDev opened this issue · 7 comments

Command

serve

Is this a regression?

  • Yes, this behavior used to work in the previous version

The previous version in which this bug was not present was

No response

Description

same to this issue #26320

Now the Vite 5 is already out but this problem is still here.

Minimal Reproduction

ng new test

cd test

ng generate component test

change app.routes.ts

import { Routes } from '@angular/router';
import {TestComponent} from "./test/test.component";

export const routes: Routes = [
{
    path: 'welcome.html', component: TestComponent
 }
];

visit http://localhost:4200/welcome.html and got Cannot GET /options.html

Exception or Error

No response

Your Environment

Angular CLI: 17.3.7
Node: 18.20.2
Package Manager: npm 10.5.0
OS: darwin arm64

Angular: 17.3.9
... animations, common, compiler, compiler-cli, core, forms
... platform-browser, platform-browser-dynamic, router

Package                         Version
---------------------------------------------------------
@angular-devkit/architect       0.1703.7
@angular-devkit/build-angular   17.3.7
@angular-devkit/core            17.3.7
@angular-devkit/schematics      17.3.7
@angular/cli                    17.3.7
@schematics/angular             17.3.7
rxjs                            7.8.1
typescript                      5.2.2
zone.js                         0.14.6

Anything else relevant?

No response

"@angular-devkit/build-angular": "17.1.0", works

17.1.1 works
17.1.2+ doesn't work

Is this the problem? 3deb0d4a1 fix return 404 for assets that are not found

17.1.2 (2024-01-31)

@angular-devkit/build-angular

Commit Type Description
6815f13e3 fix add required modules as externals imports
a0e306098 fix correctly handle glob negation in proxy config when using vite
235c8403a fix handle regular expressions in proxy config when using Vite
5332e5b2e fix resolve absolute output-path when using esbuild based builders
3deb0d4a1 fix return 404 for assets that are not found

Why do you include file extensions in your SPA routes? Including file extensions in routes is often due to legacy systems or a desire for clarity. However, this practice isn't ideal for SPAs as modern best practices favor clean, extensionless URLs. They enhance user experience, aid SEO, and ensure consistency across routes.

Why do you need two HTML files? The Chrome Extension can be a SPA where routing is managed by the Angular router.