Create-react-app: Cache-busting the favicon

Created on 21 Jun 2018  路  3Comments  路  Source: facebook/create-react-app

It would be great if during the build process we could get a hash of favicon.ico and append it to the shortcut icon href, along the lines of:

<link rel="shortcut icon" href="%PUBLIC_URL%/favicon.ico?v=%FAVICON_HASH%">
stale

Most helpful comment

Yeah I'm doing something similar currently, but it would be great if I didn't have to think about bumping the version manually.

All 3 comments

One workaround is with the .env. I have mine reading from the package.json version. Though you'd probably want to bump that as part of a build script.

.env

REACT_APP_VERSION=$npm_package_version

index.html

<link rel="shortcut icon" href="%PUBLIC_URL%/favicon.ico?v=%REACT_APP_VERSION%">

Yeah I'm doing something similar currently, but it would be great if I didn't have to think about bumping the version manually.

This issue has been automatically marked as stale because it has not had any recent activity. It will be closed in 7 days if no further activity occurs.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

ericdfields picture ericdfields  路  78Comments

razvan-soare picture razvan-soare  路  161Comments

gabrielmicko picture gabrielmicko  路  70Comments

Timer picture Timer  路  144Comments

godmar picture godmar  路  130Comments