Webpack resolve alias with env var #69448
              
                Unanswered
              
          
                  
                    
                      lucalategola
                    
                  
                
                  asked this question in
                Help
              
            Replies: 1 comment
-
| 
         Did you ever figure this out @lucalategola? Trying to accomplish something similar with an env var-based import strategy.  | 
  
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.
-
Summary
My app returns the error 'Cannot find module '@tenant/foo' or its corresponding type declarations.ts(2307)' in a typescript file when defining a dynamic alias resolve via webpack.
I defined a webpack resolve alias dinamically with an env var like this in next.config.mjs:
And in my tsconfig.json I added the tenant entry for the path:
I import my foo function into a page component with
import { fooFunction} from '@tenant/foo';and the function it works (the console log output the log), but vscode give me this errorCannot find module '@tenant/foo' or its corresponding type declarations.ts(2307).Anyone that could help me?
Thanks
Additional information
No response
Example
No response
Beta Was this translation helpful? Give feedback.
All reactions