'import '~.......` in nextJS project

I don't understand where ~ is defined in a nextJS import.

it sure does not correspond to the user's home folder, like in linux.

In one project I have it leads to the root folder of the project

in another project I have it leads to a folder under the root folder of the project.

But where is it defined? - I can't find any reference on the internet to imports using "~"



Solution 1:[1]

You can use babel-plugin-module-resolver for path aliasing https://github.com/tleunen/babel-plugin-module-resolver

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Sudip Shrestha