Import Aliases
Learn how to use import aliases like "@/..." in dinou.
Overview
dinou is ready to support import alias, as import some from "@/..."
. If you want to use them just define the options in tsconfig.json
or jsconfig.json
.
TypeScript Configuration
// tsconfig.json
{
"compilerOptions": {
// other options
"baseUrl": ".",
"paths": {
"@/*": ["src/*"]
}
},
"include": ["src/**/*"]
// other configuration fields
}
JavaScript Configuration
// jsconfig.json
{
"compilerOptions": {
"baseUrl": ".",
"paths": {
"@/*": ["src/*"]
}
},
"include": ["src"]
}
Usage Example
// Instead of relative imports
import Component from "../../../components/Component";
// Use alias imports
import Component from "@/components/Component";