Saturday, 28 December 2019

Using baseUrl in jsconfig.json not working with NextJS

https://github.com/hutber/jsconfigerror Example repo showing the jsconfig not working.

I have the following set inside my jsconig.json file:

{
  "compilerOptions": {
    "baseUrl": "./"
  }
}

However when I do an import it fails:

./pages/index.js
Module not found: Can't resolve 'components/AThing' in '/var/www/gd.hutuber.com/pages'

Folder Structure

¬ components
   ¬ AThing
¬ pages
   ¬ index.js

pages/index.js

import Head from 'components/AThing'

How can I get baseUrl to work with nextjs



from Using baseUrl in jsconfig.json not working with NextJS

No comments:

Post a Comment