Self-hosted resources from index.html
Any <link rel="stylesheet">
and <script>
elements that point to external URLs are fetched
at build time and saved to the outDir
to be self-hosted. The resources will have a content
hash in their name, so Cache-Control: immutable
can be used.
Within self-hosted .css
files, any url()
expressions that point to external URLs are also
fetched and saved to the outDir
to be self-hosted.
Note: This plugin depends on #1675
yarn add vite-plugin-rehost -D
Within your vite.config.js
file:
import rehost from 'vite-plugin-rehost'
export default {
plugins: [
rehost(),
]
}