angular-cli icon indicating copy to clipboard operation
angular-cli copied to clipboard

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

Open xxx2xxx2xxx opened this issue 1 year ago • 6 comments

Command

serve

Is this a regression?

  • [X] 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 https://github.com/angular/angular-cli/issues/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

xxx2xxx2xxx avatar May 18 '24 04:05 xxx2xxx2xxx

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

xxx2xxx2xxx avatar May 18 '24 04:05 xxx2xxx2xxx

17.1.1 works 17.1.2+ doesn't work

xxx2xxx2xxx avatar May 18 '24 05:05 xxx2xxx2xxx

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

xxx2xxx2xxx avatar May 18 '24 05:05 xxx2xxx2xxx

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.

alan-agius4 avatar May 21 '24 14:05 alan-agius4

I’m creating a chrome extension which only accepts html files. I have two pages and need two html files. I choose use routing in one project and copy final index file to two names, welcome.html and options.html.

Please let me know if there is better way to do this in one project.

On Tue, May 21, 2024 at 7:13 AM Alan Agius @.***> wrote:

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.

— Reply to this email directly, view it on GitHub https://github.com/angular/angular-cli/issues/27657#issuecomment-2122736436, or unsubscribe https://github.com/notifications/unsubscribe-auth/A6T7ANXDNWSKTE2LHYWBVU3ZDNJBVAVCNFSM6AAAAABH5EOLQ6VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDCMRSG4ZTMNBTGY . You are receiving this because you authored the thread.Message ID: @.***>

xxx2xxx2xxx avatar May 21 '24 15:05 xxx2xxx2xxx

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

alan-agius4 avatar May 22 '24 09:05 alan-agius4

Because I have a welcome page and options page.

Thanks for your reminder, I just enabled withHashLocation configuration and now am using one html file.

Previously without hash routing, I couldn't open the welcome page and options page in one html file.

On Wed, May 22, 2024 at 2:50 AM Alan Agius @.***> wrote:

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

— Reply to this email directly, view it on GitHub https://github.com/angular/angular-cli/issues/27657#issuecomment-2124348712, or unsubscribe https://github.com/notifications/unsubscribe-auth/A6T7ANWZ4CQZWL3SNCTZFI3ZDRS4XAVCNFSM6AAAAABH5EOLQ6VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDCMRUGM2DQNZRGI . You are receiving this because you authored the thread.Message ID: @.***>

xxx2xxx2xxx avatar May 25 '24 06:05 xxx2xxx2xxx

This issue has been automatically locked due to inactivity. Please file a new issue if you are encountering a similar or related problem.

Read more about our automatic conversation locking policy.

This action has been performed automatically by a bot.