Webpack Aliases
In this lesson, we will be exploring Webpack aliases.
We'll cover the following...
The module managers we have in the JavaScript community, mainly ES Modules and CommonJS, don’t support project-based paths. They only support relative paths for our own modules and paths for the node_modules
folder. When a project grows a bit, it’s common to see paths such as:
Press + to interact
import SomeComponent from "../../../../components/SomeComponent";
Luckily, we have different ways to cope with this in a way that we can define aliases for folders relative to the project root, so we could write the above line like:
Press + to interact
import SomeComponent from "@/components/SomeComponent";
The @
here is an arbitrary character to ...