The issues you mentioned are well-known in web development, not limited to PWAs. Online documentation offers excellent resources for best practices to address these problems. Services like Vercel simplify server configuration.
I recommend using Next.js to create your website. It offers server-side rendering and enable edge location, enhancing performance. It also supports Content Security Policy (CSP) to minimize XSS attacks. Additionally, it includes default PWA support.
Server-side rendering provides unlimited power and consistent user experiences across devices, it's a game-changer for developers and users don't even have to update the app.