webpack-csp-plugin

3.0.0 • Public • Published

Webpack CSP Plugin

This plugin generates a CSP header from your webpack build.

Hashing is used over nonces to prevent modifying the build in unexpected ways.

Right now workers (Worker, SharedWorker, ServiceWorker) are not parsed due to the complexity of how they can be mounted, so you will need to add those rules manually.

new WebpackCspPlugin({
  output: 'csp_header.txt', // or `(header) => { ... }`
  reportUri: 'https://example.com/cspreport', // if you have a csp reporting server
  workers: ['https://worker.io/sw.js'], // if you use workers (see above)
  // defaults, styles, scripts, fonts, etc.
});

Dependents (0)

Package Sidebar

Install

npm i webpack-csp-plugin

Weekly Downloads

6

Version

3.0.0

License

MIT

Last publish

Collaborators

  • snek