Astro's docs here: https://docs.astro.build/en/guides/troubleshooting/#refused-to-execute-inline-script suggest the following config to force script and styles to be not inlined, so that an astro generated site is comptible with Content-Security-Policy that doesn't allow unsafe-inline:
export default defineConfig({
vite: {
build: {
assetsInlineLimit: 0,
},
},
});
This works for a site that uses simple Astro components. It stops working once you start using the Astro Islands architecture to hydrate e.g. svelte components. Astro always inlines the island hydration script and related style, even wiht the above configuration.
It would be nice if the documentation could be updated to reflect this. Hopefully with an alternative way to achieve the island hydration script and style not to be inlined in the html..