typescriptwebpacknext.jstypescript-module-resolution

What does the @ mean in `import from '@/some/path'`


Using IntelliJ IDEA to write a webapp in TypeScript, it autocomplete imports from other files of my project like this:

import {Symbol} from '@/components/Symbol';

What is the meaning of the @ here? Where is it documented?

Note that this is when importing files from the same project. Imports from npm packages only use the package name (which may start with a @).

I haven’t found anything about this in TypeScript Module Resolution, and when searching for typescript @ import in Google or SO, it seems the @ character from the query is ignored...

Edit: This is in a Next.js project created with npx create-next-app.


Solution

  • This turned out to be a tsconfig path, which was put there by npx create-next-app:

    {
      "compilerOptions": {
        "paths": {
          "@/*": ["./src/*"]
        }
      },
    }