Hello,
I have issue with autominify html in react ssr apps. The same as described here:
https://marek-rozmus.medium.com/nextjs-and-react-hydration-problem-on-production-2004c6f166bd
https://github.com/vercel/next.js/issues/15876
Example is showed here: https://test.koduj-beta.it/
necessarily make sure you’re viewing source, not via devtools.
I know I can disable it via header, from cf ui, via page rule.
But ideally I would like to prepare data as minify html makes it - before sending it to browser I could wrap string, minify it, and return to the client.
and here is my question - do you know any npm library which in the same way can prepare html as cf is doing it? or at least how could I prepare html in the same way?
more technical:
I’m using nextjs and this function sends json (which is not minified) in inline script tag.
export const getServerSideProps = () => {
const { test } = {
test: '7\t100 słoni, 1,1\tmiliarda ziarenek piasku. ',
};
const foo = {
props: {
test,
},
};
return JSON.parse(
JSON.stringify(foo) # <- I can modify it here
);
};