Skip to content

alloc/vite-plugin-rehost

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

46 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

vite-plugin-rehost

npm Code style: Prettier Donate

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

 

Usage

yarn add vite-plugin-rehost -D

Within your vite.config.js file:

import rehost from 'vite-plugin-rehost'

export default {
  plugins: [
    rehost(),
  ]
}