question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Add build.assetInlineExclude config

See original GitHub issue

Is your feature request related to a problem? Please describe.

When building for production, the following line :

<!-- index.html -->
<link rel="icon" type="image/png" href="favicon.png">

get transformed in this

<!-- index.html -->
<link rel="icon" type="image/png" href="data:image/png;base64,...(not included)...">

Inlining the favicon png does not allow browser caching. I’d rather like it to not be inlined but keep inline feature for other files.

Describe the solution you’d like

Have a way to exclude some files from being inlined.

A clear and concise description of what you want to happen.

// vite.config.js
export default {
  build: {
    assetInlineExclude: ['favicon.png']
  }
}

Would all assets except inline favicon.png.

Describe alternatives you’ve considered

Setting build.assetInlineLimit: 0 disables asset inlining but I want to keep it for other files than favicon.png.

Issue Analytics

  • State:open
  • Created 3 years ago
  • Reactions:6
  • Comments:8 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
CHOYSENcommented, Mar 1, 2021

You can also move the icon file into a public folder if it is simply introduced in index.html.

https://vitejs.dev/guide/assets.html#the-public-directory

0reactions
onionhammercommented, Oct 23, 2022

You can also move the icon file into a public folder if it is simply introduced in index.html.

https://vitejs.dev/guide/assets.html#the-public-directory

This is true if you don’t want cache busting

Read more comments on GitHub >

github_iconTop Results From Across the Web

Webpack 5: file-loader generates a copy of fonts with hash ...
We can set the type to 'javascript/auto'. This would follow your path setting and keep the font files in the assets/fonts folder. {...
Read more >
Vite Issue Overview · Discussion #8232 · vitejs/vite · GitHub
Add build.assetInlineExclude config #2173 feat: add assets inline exclude #6892 feat: support callback for build.assetsInlineLimit #8717; SRI support Add ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found