Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

postcss-url causes CSP valolation when url is set to 'inline' #182

Open
HesamSe opened this issue Nov 27, 2023 · 0 comments
Open

postcss-url causes CSP valolation when url is set to 'inline' #182

HesamSe opened this issue Nov 27, 2023 · 0 comments

Comments

@HesamSe
Copy link

HesamSe commented Nov 27, 2023

I want to embed my font and image files into my js file using postcss-url.
Here is my postcss config:

module.exports = {
    plugins: {
        tailwindcss: {
            config: join(__dirname, 'tailwind.config.js'),
        },
        autoprefixer: {},
        cssnano: {},
        'postcss-import': {},
        'postcss-url': {
            url: "inline",
            maxSize: 128 * 1024,
            useHash: true,
        }
    },
};

Everything works fine in development mode. But when I moved built files to the server, I faced this error in browser:

main.195fbc3377ced840.js:2 Refused to apply inline style because it violates the following Content Security Policy directive: "default-src 'self'". Either the 'unsafe-inline' keyword, a hash ('sha256-47DEQpj8HBSa+/TImW+5JCeuQeRkm5NMpJWZG3hSuFU='), or a nonce ('nonce-...') is required to enable inline execution. Note also that 'style-src' was not explicitly set, so 'default-src' is used as a fallback.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant