Issue with Tailwind CSS #29816
              
                Unanswered
              
          
                  
                    
                      karakaiyuliia
                    
                  
                
                  asked this question in
                Component Testing
              
            Replies: 1 comment
-
| What worked for me is to add the following code to styles.ts: // Prevent Next.js CSS insertion error
if (!document.querySelector('#__next_css__DO_NOT_USE__')) {
  const styleNode = document.createElement('style');
  styleNode.id = '__next_css__DO_NOT_USE__';
  document.head.appendChild(styleNode);
}
export {};and then import this file in component.ts | 
Beta Was this translation helpful? Give feedback.
                  
                    0 replies
                  
                
            
  
    Sign up for free
    to join this conversation on GitHub.
    Already have an account?
    Sign in to comment
  
        
    
Uh oh!
There was an error while loading. Please reload this page.
-
Cypress does not work with Tailwind CSS. I was following the setup in this repo and none of the suggested setups work for me, they all result in the below error when simply trying to mount a component.

I compiled my tailwind css using
tailwindcss -i src/tailwind.css -o src/index.cssIn my
component.js:In
cypress.config.js:And my test:
I am using React, Next.js and Tailwind.
Beta Was this translation helpful? Give feedback.
All reactions