{"id":22858,"library":"vite-plugin-subresource-integrity","title":"vite-plugin-subresource-integrity","description":"Vite plugin that adds subresource integrity (SRI) hashes to script and stylesheet imports in index.html at build time. Version 0.0.12 is the latest, with an unknown release cadence. It is a TypeScript rewrite of @small-tech/vite-plugin-sri, offering native type definitions and support for multiple frameworks (Vue, React, Svelte, Solid, Qwik, Lit, Preact, vanilla). Key differentiators: lightweight, no runtime overhead, and simple configuration. Alternatives include rollup-plugin-sri and @small-tech/vite-plugin-sri.","status":"active","version":"0.0.12","language":"javascript","source_language":"en","source_url":"https://github.com/JADSN1894/vite-plugin-sri","tags":["javascript","Vite","Subresource","Integrity","SRI","Plugin","typescript"],"install":[{"cmd":"npm install vite-plugin-subresource-integrity","lang":"bash","label":"npm"},{"cmd":"yarn add vite-plugin-subresource-integrity","lang":"bash","label":"yarn"},{"cmd":"pnpm add vite-plugin-subresource-integrity","lang":"bash","label":"pnpm"}],"dependencies":[],"imports":[{"note":"Default export. Only ESM supported; no CJS require.","wrong":"const subresourceIntegrity = require('vite-plugin-subresource-integrity')","symbol":"subresourceIntegrity","correct":"import subresourceIntegrity from 'vite-plugin-subresource-integrity'"},{"note":"Not a named export; must use default import.","wrong":"import { subresourceIntegrity } from 'vite-plugin-subresource-integrity'","symbol":"default export","correct":"import subresourceIntegrity from 'vite-plugin-subresource-integrity'"},{"note":"Type import for TypeScript users.","wrong":"","symbol":"VitePluginSubresourceIntegrity","correct":"import type { VitePluginSubresourceIntegrity } from 'vite-plugin-subresource-integrity'"}],"quickstart":{"code":"// vite.config.js\nimport { defineConfig } from 'vite';\nimport subresourceIntegrity from 'vite-plugin-subresource-integrity';\n\nexport default defineConfig({\n  plugins: [subresourceIntegrity()]\n});","lang":"typescript","description":"Basic Vite configuration integrating the subresource integrity plugin."},"warnings":[{"fix":"No fix needed; SRI is only relevant for production builds.","message":"Plugin only works at build time, not in dev mode.","severity":"gotcha","affected_versions":"<=0.0.12"},{"fix":"Order plugins carefully: subresourceIntegrity() should be placed after HTML manipulation plugins.","message":"Plugin modifies index.html after build. If using custom HTML templates, ensure the plugin runs after other HTML transformers.","severity":"gotcha","affected_versions":"<=0.0.12"},{"fix":"Continue using this plugin or switch to rollup-plugin-sri if needed.","message":"This plugin is a fork; original @small-tech/vite-plugin-sri is unmaintained.","severity":"deprecated","affected_versions":"<=0.0.12"},{"fix":"Manually add integrity attributes in HTML for dynamic chunks or use a full rollup SRI plugin.","message":"Does not support dynamic imports or async chunks by default.","severity":"gotcha","affected_versions":"<=0.0.12"}],"env_vars":null,"search_vec":"'/vite-plugin-sri':43,80 '0.0.12':25 'add':9 'altern':70 'build':22 'cadenc':33 'configur':69 'definit':47 'differenti':62 'framework':52 'hash':13 'import':18 'includ':71 'index.html':20 'integr':5,11,84 'javascript':81 'key':61 'latest':28 'lightweight':63 'lit':58 'multipl':51 'nativ':45 'offer':44 'overhead':66 'plugin':3,7,74,86 'preact':59 'qwik':57 'react':54 'releas':32 'rewrit':38 'rollup':73 'rollup-plugin-sri':72 'runtim':65 'script':15 'simpl':68 'small':41,78 'small-tech':40,77 'solid':56 'sri':12,75,85 'stylesheet':17 'subresourc':4,10,83 'support':49 'svelt':55 'tech':42,79 'time':23 'type':46 'typescript':37,87 'unknown':31 'vanilla':60 'version':24 'vite':2,6,82 'vite-plugin-subresource-integr':1 'vue':53","created_at":"2026-04-27T17:07:27.991107+00:00","updated_at":"2026-04-27T17:07:27.991107+00:00","problems":[{"fix":"Run `npm i --save-dev vite-plugin-subresource-integrity` and ensure import using default import.","cause":"Plugin not installed or incorrect import path.","error":"Error: Cannot find module 'vite-plugin-subresource-integrity'"},{"fix":"Replace `require()` with `import` statement.","cause":"Using require() in an ESM context.","error":"ReferenceError: require is not defined"},{"fix":"Use `import subresourceIntegrity from 'vite-plugin-subresource-integrity'`.","cause":"Using named import instead of default import.","error":"TypeError: subresourceIntegrity is not a function"}],"ecosystem":"npm","meta_description":null,"install_score":null,"quickstart_score":null,"quickstart_tag":null,"pypi_latest":null,"cli_name":"","cli_version":null,"type":"library","homepage":null,"github":"https://github.com/JADSN1894/vite-plugin-sri","docs":null,"changelog":null,"pypi":null,"npm":"https://www.npmjs.com/package/vite-plugin-subresource-integrity","openapi_spec":null,"status_page":null,"smithery":null,"categories":["auth-security","http-networking"],"base_url":null,"auth_type":null,"provenance":{"verified_status":null,"verified_at":null,"last_verified":"2026-06-18","next_check":"2026-07-26","install_tag":null}}