Extract Bootstrap's inline SVGs to actual resources

Previously, we were required to allow `data:` URLs for img-src in our CSP, since Bootstrap icons were delivered through this mechanism.
This commit is contained in:
Sebastian Serth
2024-04-13 18:31:23 +02:00
committed by Sebastian Serth
parent 7b769a7673
commit 6c06db8b9c

View File

@ -24,6 +24,17 @@ const envConfig = module.exports = {
}, },
module: { module: {
rules: [ rules: [
// Extract Bootstrap's inline SVGs to actual resources.
// This removes the requirement for `data:` URLs in our CSP
// See https://getbootstrap.com/docs/5.3/getting-started/webpack/#extracting-svg-files
{
mimetype: 'image/svg+xml',
scheme: 'data',
type: 'asset/resource',
generator: {
filename: 'icons/[hash].svg'
},
},
erb erb
] ]
}, },