Add build.assetInlineExclude config
See original GitHub issueIs 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:
- Created 3 years ago
- Reactions:6
- Comments:8 (3 by maintainers)
Top 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 >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
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