So for production build here's a CSP configuration you want:
"security": {
"csp": "default-src 'self' style-src 'self' 'unsafe-inline'"
},
According to OWASP and CSP reference adding unsafe-inline is not secure for the Web, but it context of Tauri it's a smaller risk you have to evaluate.
Overall it's a problem of how Vite packages CSP, including styled-components.
If you want to keep debugging this, this vite and babel configuration might be relevant.
======
Here's the source code.
Used default example:
import styled from 'styled-components';
const Title = styled.h1`
font-size: 1.5em;
text-align: center;
color: palevioletred;
`;
//.....
return (
<div className="container">
<Title>Welcome to Tauri!</Title>
//...
