Skip to content

Commit

Permalink
add csp-html-webpack-plugin
Browse files Browse the repository at this point in the history
  • Loading branch information
storywithoutend committed May 13, 2024
1 parent fba0767 commit d715555
Show file tree
Hide file tree
Showing 3 changed files with 119 additions and 5 deletions.
1 change: 1 addition & 0 deletions docs/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
"@reach/skip-nav": "^0.16.0",
"@sindresorhus/slugify": "^2.1.0",
"copy-to-clipboard": "^3.3.1",
"csp-html-webpack-plugin": "^5.1.0",
"gray-matter": "^4.0.3",
"lodash": "^4.17.21",
"next": "12.3.0",
Expand Down
9 changes: 9 additions & 0 deletions docs/playroom.config.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
const path = require('path')
const CspHtmlWebpackPlugin = require('csp-html-webpack-plugin')

module.exports = {
components: './src/playroom/components.ts',
Expand All @@ -16,6 +17,14 @@ module.exports = {
iframeSandbox: 'allow-scripts allow-same-origin',

webpackConfig: () => ({
plugins: [
new CspHtmlWebpackPlugin({
'worker-src': "'self'",
'script-src': ["'self'", "'sha256-UyYcl+sKCF/ROFZPHBlozJrndwfNiC5KT5ZZfup/pPc='", 'static.cloudflareinsights.com', '*.ens-app-v3.pages.dev'],
'frame-ancestors': ["'self"],

})
],
module: {
rules: [
{
Expand Down
114 changes: 109 additions & 5 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit d715555

Please sign in to comment.