0.0.12 • Published 1 month ago

vite-plugin-subresource-integrity v0.0.12

Weekly downloads
-
License
MIT
Repository
github
Last release
1 month ago

Svelte SRI plugin

Adds subresource integrity hashes to script and stylesheet imports from your index.html file at build time.

Before

Before build

After

After build

Usage

  1. npm i --save-dev vite-plugin-subresource-integrity
  2. import subresourceIntegrity from "vite-plugin-subresource-integrity";
  3. In your vite.config.js file:
import { defineConfig } from 'vite'
import subresourceIntegrity from 'vite-plugin-subresource-integrity'

export default defineConfig({
  // …
  plugins: [subresourceIntegrity()]
})

Tested in

FrameworkVersion
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)

Alternatives

rollup-plugin-sri

@small-tech/vite-plugin-sri

References

Rollup - Build Hooks

Third Party JavaScript Management Cheat Sheet

Content Security Policy Cheat Sheet

Ship ESM & CJS in one Package

Repositories

Fork of @small-tech/vite-plugin-sri that uses typescript

gatsby-plugin-sri

vite-plugin-inspect

DefinitelyTyped

GitHub issues

How to execute a plugin after assets are fully generated?

Discord

How can I add Subresource Integrity(SRI) for Svelte/Svelte Kit after build

Contributing

Found a bug, have a suggestion for a new feature? Submit an issue.

0.0.12

1 month ago

0.0.11

10 months ago

0.0.10

10 months ago

0.0.8

10 months ago

0.0.7

10 months ago

0.0.5

10 months ago

0.0.4

10 months ago

0.0.3

10 months ago

0.0.2

10 months ago

0.0.0

10 months ago

0.1.2

10 months ago

0.1.1

10 months ago

0.1.0

10 months ago