DEV Community

Paul C. Ishaili
Paul C. Ishaili

Posted on

3 2

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)

Billboard image

The Next Generation Developer Platform

Coherence is the first Platform-as-a-Service you can control. Unlike "black-box" platforms that are opinionated about the infra you can deploy, Coherence is powered by CNC, the open-source IaC framework, which offers limitless customization.

Learn more

👋 Kindness is contagious

Please leave a ❤️ or a friendly comment on this post if you found it helpful!

Okay