A Vite plugin to auto-generate Subresource Integrity (SRI) hashes.
npm install vite-plugin-sri-gen
Add Subresource Integrity (SRI) hashes to your Vite build HTML output automatically.
- Adds integrity attribute to script tags, stylesheet links, and modulepreload links in index.html
- Works out of the box in production builds
- Optionally injects rel="modulepreload" with integrity for lazy-loaded chunks
- Optionally injects a tiny CSP-safe runtime that adds integrity/crossorigin to dynamically inserted \