@vividlemon/vite-plugin-sri
v1.2.0
Published
A Vite plugin that adds subresource integrity hashes to your index.html file at build time.
Downloads
2,765
Maintainers
Readme
vite-plugin-sri
@vividlemon/vite-plugin-sri generates the integrity value in the transformIndexHtml hook, and if dynamic imports are used in the code, the correct integrity cannot be generated. This plugin is designed to solve this problem
Subresource integrity (SRI) plugin for Vite
Adds subresource integrity hashes to script and stylesheet imports from your index.html file at build time
Install
npmp i --D @vividlemon/vite-plugin-sri
Use
In your vite.config.ts
file:
import { defineConfig } from 'vite'
import sri from '@vividlemon/vite-plugin-sri'
export default defineConfig({
// …
plugins: [sri()]
})