Components that import modules with path aliases fail to mount #31029
              
                Unanswered
              
          
                  
                    
                      rodneyallanprice
                    
                  
                
                  asked this question in
                Component Testing
              
            Replies: 0 comments
  
    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.
Uh oh!
There was an error while loading. Please reload this page.
-
We are using Nuxt 3.15.2 with Vite and Vue. Nuxt/Vite configures path aliases for '@' and '~' that work fine when run normally. Those aliases are not recognized when mounting a component with Cypress.
An answer to a question previously posted on this site suggested removing 'viteConfig' from the component section of the cypress config file and configuring the needed aliases in one of several vite config files as follows.
Outside of the Nuxt environment, this works.
However, Nuxt wants to own vite configuration, and complains when I create one of the vite config files suggested by Cypress.
When using Nuxt to configure Vite, is there a way to tell Cypress component tests how to translate the aliases?
Beta Was this translation helpful? Give feedback.
All reactions