reactjstypescriptsnowpack

Path Mapping Issue in React-TypeScript-Snowpack


I am using React, TypeScript and Snowpack in a project. I am facing issue in path mapping.

This is the folder structure in my project:

enter image description here

tsconfig.json

enter image description here

snowpack.coonfig.js

enter image description here

App.tsx

enter image description here

This is the error I am getting:

enter image description here

Can anyone please help me fix this? What am I missing here? If in App.tsx, I ctrl+click on HomePage import, it takes me to that page but when I run yarn start, it gives the above error.


Solution

  • You might need to add 'app' alias to snowpack config too so it recognizes it.

    https://www.snowpack.dev/reference/configuration#alias