In the future, this repository will be archived or maybe deleted and migrated to the following repository, which is accessible through the jsr.io package registry.
Adds subresource integrity hashes to script and stylesheet imports from your index.html
file at build time.
npm i --save-dev vite-plugin-subresource-integrity
import subresourceIntegrity from "vite-plugin-subresource-integrity";
- In your
vite.config.js
file:
import { defineConfig } from 'vite'
import subresourceIntegrity from 'vite-plugin-subresource-integrity'
export default defineConfig({
// …
plugins: [subresourceIntegrity()]
})
Framework | Version |
---|---|
vanilla(v5.1.6) | |
vue(v3.3.4) | |
react(v18.2.0) | |
preact(v10.16.0) | |
lit(v2.8.0) | |
svelte(v4.1.2) | |
solid(v1.7.9) | |
qwik(v1.2.6) |
Third Party JavaScript Management Cheat Sheet
Content Security Policy Cheat Sheet
Fork of @small-tech/vite-plugin-sri that uses typescript
How to execute a plugin after assets are fully generated?
How can I add Subresource Integrity(SRI) for Svelte/Svelte Kit after build
Found a bug, have a suggestion for a new feature? Submit an issue.