Getting Started
  • Introduction
  • Installation
  • About
Core Concepts
  • Routing System
  • Page Functions
  • Data Fetching
  • Server Components
  • Client Components
Features
  • Dynamic & Query Parameters
  • Navigation
  • Styles & CSS
  • Images
  • Favicons
Configuration
  • Environment Variables
  • Import Aliases
  • Ejecting
dinou logodinou
docs
npmGitHub

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";

On This Page

OverviewTypeScript ConfigurationJavaScript Configuration