Search code examples
webpackvuejs3content-security-policyprimevue

how to add content security policy (csp) for primevue in vue 3 composition api


when I set csp to my vue project, it will break csp due to style tags generated by primevue.

refer below error:

i already added hash in csp, but don't know how to add hash in this auto generated styles by primevue.


Solution

  • Now prime vue give support of content security policy with nonce.. refer below images: enter image description here

    enter image description here

    Now only need to add follow code in config and it works properly:

    app.use(PrimeVue, {
        csp: {
            nonce: '...'
        }
    });