Search code examples
javascriptnext.jsmetadata

What is <noscript id="__next_css__DO_NOT_USE__"></noscript> in an NextJS app


Learning NextJS, I'm up to adding metadata. After completing the steps in that lesson, in the front-end source code I see

<noscript id="__next_css__DO_NOT_USE__"></noscript>

What is it for, and what produces it?

A Google search doesn't display much.


Solution

  • I just Googled it and the second result explains what it's for: https://dev.to/omher/building-react-app-with-module-federation-and-nextjsreact-1pkh It's apparently simply a marker for Next to know where in the document to insert the CSS.

    The reason it is an empty noscript tag is to make it basically invisible in the DOM and doesn't risk interfering with your page.