Подписаться на блог

How to inline TailwindCSS styles to SSR NextJS

By default, NextJS may not include Tailwind styles in the SSR build, and with disabled JavaScript, your site may look ugly like pure HTML.

To fix this, you need to install the critters package.

npm install critters

And enable optimizeCss rule in next.config.js.

experimental: {
    optimizeCss: true,
},

Source: next.js#12868.