Skip to content

CSP not working with minification integrations #14288

@jurajkapsz

Description

@jurajkapsz

Astro Info

Astro                    v5.13.4
Node                     v24.6.0
System                   Linux (x64)
Package Manager          pnpm
Output                   static
Adapter                  @astrojs/node
Integrations             mysong-compress

If this issue only occurs in one browser, which browser is a problem?

No response

Describe the Bug

When using Astro CSP alongside with compress integrations eg mysong-compress or @playform/compress, inlined styles and scripts fail to apply.

Refused to apply inline style because it violates the following Content Security Policy directive...

Probably because CSP hash generation runs before minification?

What's the expected result?

Be able to use compressions along with Astro CSP.

Link to Minimal Reproducible Example

https://stackblitz.com/edit/github-n8kutkgp?file=astro.config.mjs

Participation

  • I am willing to submit a pull request for this issue.

Metadata

Metadata

Assignees

No one assigned

    Labels

    needs triageIssue needs to be triaged

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions