Recently, i started using subpath imports in my node project for mainly my utilities directory. It allowed me to go from
const { promptMessage } = require('../../../../utils/promptMessage.js');
to
const { promptMessage } = require('#utils/promptMessage.js');
The problem i have however, is that my intellisense is no longer working. I found some things with jsconfig.json, but those only seem to work on import statements, not require(). Is there a way to get intellisense with subpath imports?
In combination with the imports in package.json i was able to get back intellisense by creating a jsconfig.json file looking like this:
{
"compilerOptions": {
"baseUrl": ".",
"paths": {
"#utils/*": ["./utils/*"],
"#database/*": ["./database/*"],
"#file": ["./dir/file.js"],
"#colors": ["./commanddata/colors.json"]
}
}
}