Skip to content

How to make build work with Chrome extensions CSP restrictions? #1767

Answered by rschristian
michaelaflores asked this question in Q&A
Discussion options

You must be logged in to vote

I'm gathering this issue is somehow related to however preact-cli via its webpack config is injecting the loaded JS, as compared to how CRA was doing it

Have you tried comparing Preact-CLI's output HTML to CRA's? That's the best I can suggest really without knowing how you've configured and set things.

I personally know nothing about extensions or CSP, but have you looked at csp-html-webpack-plugin? Looks like it might do what you want. If you need full control over your HTML, you can rip out <% preact.headEnd %> and <% preact.bodyEnd %> from your template.html and replace them with the content from head-end.ejs and body-end.ejs, respectively. They're abstracted away as users usually do…

Replies: 2 comments 4 replies

Comment options

You must be logged in to vote
3 replies
@michaelaflores
Comment options

@rschristian
Comment options

@michaelaflores
Comment options

Answer selected by michaelaflores
Comment options

You must be logged in to vote
1 reply
@laciferin2024
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants