1.0.0-alpha.1 • Published 7 months ago

vite-subresource-integrity-plugin v1.0.0-alpha.1

Weekly downloads
-
License
MIT
Repository
github
Last release
7 months ago

vite-subresource-integrity-plugin

npm ci

English | 简体中文

Subresource Integrity (SRI) is a security feature that enables browsers to verify that resources they fetch (for example, from a CDN) are delivered without unexpected manipulation. It works by allowing you to provide a cryptographic hash that a fetched resource must match.

Install

npm i vite-subresource-integrity-plugin -D

pnpm add vite-subresource-integrity-plugin -D

yarn add vite-subresource-integrity-plugin -D

Usage

// vite.config.js
import viteSriPlugin from 'vite-subresource-integrity-plugin'

export default {
  plugins: [
    viteSriPlugin({
      algorithm: ['sha256', 'sha384']
    })
  ]
}

Options

paramtypedefaultdescription
algorithmstring string[]['sha384']Specifying the name of a hash function to be used for calculating integrity hash values
manifestboolean stringtrueIf manifest is a true value, the plugin will output a manifest file, and you can pass manifest as a string to set the name of the file
extensionsstring[]['.js', '.css']Types of assets the plugin needs to handle
enabledbooleantrueEnable or disable plugin
1.0.0-alpha.1

7 months ago

1.0.0-alpha.0

7 months ago

0.0.1

7 months ago