angular / angular-cli

CLI tool for Angular
https://cli.angular.io
MIT License
26.76k stars 11.97k forks source link

Default generated favicon.ico doesn't work -> rename to png works #28645

Closed hci2 closed 1 week ago

hci2 commented 1 week ago

Command

new

Is this a regression?

The previous version in which this bug was not present was

No response

Description

When scaffolding a new Angular project via ng new <PROJECT_NAME> the generated favicon.ico does not work. I just renamed it to favicon.png and changed the reference in index.html and it works immediately.

How about changing the scaffolding to use PNG instead of *.ico?

Minimal Reproduction

favicon.ico (default after generating via ng create):

Image

favicon.png (after renaming and changing):

Image

Exception or Error

No response

Your Environment

 _                      _                 ____ _     ___
/ \   _ __   __ _ _   _| | __ _ _ __     / ___| |   |_ _|

/ △ \ | ' \ / | | | | |/ _ | '| | | | | | | / _ | | | | (| | || | | (| | | | || |_ | | // __| ||_, |_,||_,|| __|__|| |/

Angular CLI: 18.2.8 Node: 20.17.0 Package Manager: npm 10.9.0 OS: darwin arm64

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

Package Version

@angular-devkit/architect 0.1802.8 @angular-devkit/build-angular 18.2.8 @angular-devkit/core 18.2.8 @angular-devkit/schematics 18.2.8 @schematics/angular 18.2.8 rxjs 7.8.1 typescript 5.5.4 zone.js 0.14.10

Anything else relevant?

IDE: VS Code (1.94.2 (Universal)) Browser: Chrome (129.0.6668.91 (Official Build) (arm64)) OS: MacOS (15.0.1)

hci2 commented 1 week ago

Moreover, I also noticed that the docs are not up-to-date regarding src/assets and src/favicon.ico, see: https://angular.dev/reference/configs/workspace-config#assets-configuration.

alan-agius4 commented 1 week ago

Hi @hci2, I couldn't reproduce the issue you've mentioned.

Image

Regarding the documentation issue, please open an issue at https://github.com/angular/angular.

hci2 commented 1 week ago

Hmmm, that is weird. I double-checked and it worked in Safari and Firefox as well.

I tried different variants and came to this entry in Stackoverflow (https://stackoverflow.com/a/28436056/11494882) to force the browser to refresh via setting <link rel="icon" type="image/x-icon" href="favicon.ico?v=2"> in index.html and then this finally worked.

After setting version: Image

We can close this ticket because it has to do with the caching of Chrome and is not related to the code. Thank you anyway for your help.