search

Home  >  Q&A  >  body text

Using @ for import in React.js

I'm trying to adapt a Next.js template to start a new project. However, I have seen this type of import in previous projects.

import config from "@config/config.json";
import theme from "@config/theme.json";

I would like to know how to do this type of import using @. Which term should I search in the documentation to achieve this?

I would appreciate any explanation.

P粉682987577P粉682987577439 days ago677

reply all(1)I'll reply

  • P粉401527045

    P粉4015270452023-09-18 11:25:09

    Create a jsconfig.json file in the root of your directory and

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

    Enjoy it

    reply
    0
  • Cancelreply