This package has been deprecated

Author message:

Package no longer supported. Moved to https://www.npmjs.com/package/vite-plugin-csp-guard

vite-plugin-hash-csp
TypeScript icon, indicating that this package has built-in type declarations

0.6.3 • Public • Published

Vite Plugin Hash CSP

This package has moved to vite-plugin-csp-guard

Documentation

Full documentation and helpful guides are available here.

Installation

npm install -D vite-plugin-hash-csp
# or
yarn add -D vite-plugin-hash-csp
# or
pnpm add -D vite-plugin-hash-csp

Basic Usage

// vite.config.ts
import { defineConfig } from "vite";
import csp from "vite-plugin-hash-csp";

export default defineConfig({
  plugins: [
    csp({
      algorithm: "sha256", // The algorithm to use for hashing
      dev: {
        run: true, // If you want to run the plugin in `vite dev` mode
      },
      policy: {
        // Specify the policy here.
        "script-src": ["'self'", "https://www.google-analytics.com"], // Example: Allow Google Analytics
        "style-src": ["'self'", "https://fonts.googleapis.com"], // Example: Allow Google Fonts
      },
    }),
  ],
});

Package Sidebar

Install

npm i vite-plugin-hash-csp

Weekly Downloads

1

Version

0.6.3

License

GPL-3.0-only

Unpacked Size

61.4 kB

Total Files

28

Last publish

Collaborators

  • tsotrocki