Path resolving is great, as it helps with avoiding ugly …/…/…/ imports. Find out how to set up alias path resolving with Vite.
Some time ago I have tried to use Vite for some of my tutorial projects. After setting up a project with Vite and creating a new component, I tried to import it the usual way I would do it when working with projects scaffolded with Vue-CLI, with the @ sign that resolves to the src
directory. To my surprise, it did not work and I was welcome with this error:
It turns out that Vite does not have src
path resolving by default. Fortunately, it’s quite easy to configure it.
#vue #javascript