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.
TypeScript Configuration
// tsconfig.json
{
"compilerOptions": {
"baseUrl": ".",
"paths": {
"@/*": ["src/*"]
},
"allowJs": true,
"noEmit": true,
"jsx": "react-jsx",
"strict": true
},
"include": ["src"]
}JavaScript Configuration
// tsconfig.json
{
"compilerOptions": {
"baseUrl": ".",
"paths": {
"@/*": ["src/*"]
},
"allowJs": true,
"noEmit": true
},
"include": ["src"]
}Usage Example
// Instead of relative imports
import Component from "../../../components/Component";
// Use alias imports
import Component from "@/components/Component";