Doplax.Dev
  • Home
  • About me
  • Blog
  • Work Experience
  • Contact
  • Home
  • About me
  • Blog
  • Work Experience
  • Contact

Got a project in mind or just want to say hi?

Get in touch

© 2026 Doplax.Dev — All rights reserved.

November 30, 2023

Simplify Your Imports in JavaScript with Module Aliases

  • Productivity

If you've ever found yourself typing long relative paths in your JavaScript or TypeScript code, this article will unveil an efficient and elegant way to simplify your imports using module aliases.


How to configure Module Alias:

Module alias configuration is done in the tsconfig.json, tsconfig.app.json, or jsconfig.json file, depending on your project.

you're working with JavaScript, you can use jsconfig.json in the same way:

{
  "compilerOptions": {
    "baseUrl": "./",
    "paths": {
      "@components/*": ["src/components/*"],
      "@services/*": ["src/services/*"],
      "@utils/*": ["src/utils/*"]
    }
  }
}

Once configured, you can import modules like this in your JavaScript code:

import Button from '@components/Button';
import AuthService from '@services/AuthService';
import { formatDate } from '@utils/dateUtils';

Benefits of Using Module Aliases**:**

Module aliases are a powerful tool for simplifying your imports in JavaScript/TypeScript projects. If you're tired of typing long and confusing relative paths, you should definitely consider using this technique. Also, remember that alias configuration is done in tsconfig.json, tsconfig.app.json, or jsconfig.json, depending on your project. Streamline your code and enhance your workflow with this practical technique!

PreviousCómo Convertir Strings a Números en JavaScriptNextPara que sirve HostBinding?

Related posts

  • Core vs Shared: diferencias clave entre estas carpetas en la arquitectura de un proyectoProductivity

Written by Pol Valle

Written by Pol Valle

I'm particularly drawn to building apps that are not only functional but also visually appealing and easy to use. I do it by applying SOLID principles, clean architecture and testing to ensure quality.