Important: This documentation covers Yarn 1 (Classic).
For Yarn 2+ docs and migration guide, see yarnpkg.com.

Package detail

@vividlemon/vite-plugin-sri

VividLemon15.1kMIT1.2.0

A Vite plugin that adds subresource integrity hashes to your index.html file at build time.

Vite, Subresource, Integrity, SRI, plugin

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()]
})

changelog

Changelog

All notable changes to this project will be documented in this file.

The format is based on Keep a Changelog, and this project adheres to Semantic Versioning.

[1.2.0] - 2023-09-05

TypeScript v5 enhancements, and various other fixes

[1.0.1] - 2021-03-31

Smaller package.

Improved

  • Remove unnecessary files from npm package.

[1.0.0] - 2021-03-31

Initial release.