DEV Community

Paul C. Ishaili
Paul C. Ishaili

Posted on

Use Absolute path in importing components - React || Next

Simply create a jsconfig.json file in your base directory, then copy this code into it, then save.

{
  "compilerOptions": {
    // make all imports without a dot '.' prefix relative to the base url
    "baseUrl": ".",
    "paths": {
      "@/component/*": ["compomponents/*"]
    }
  }
}
Enter fullscreen mode Exit fullscreen mode

Programming class enrollment for August: https://paystack.com/pay/ovuc-xymw6

Top comments (0)