Reputation: 21
This is a little weird. I tried to shorten my import statements with this jsconfig.json:
{
"compilerOptions": {
"baseUrl": "./",
"paths": {
"@/*": ["./*"]
}
}
}
Now the weird thing is that Intellisense actually recognizes this file and gives me an auto-fill to import it.
For example: ( Please Ignore the weird file structure I've been trying out different things trying to fix this )
import { PORT } from "@/env/index";
File structure is as follows: File Structure
The error that node throws is:
internal/process/esm_loader.js:74
internalBinding('errors').triggerUncaughtException(
^
Error [ERR_MODULE_NOT_FOUND]: Cannot find package '@/env' imported from C:\Users\[Censored]\main.js
at packageResolve (internal/modules/esm/resolve.js:664:9)
at moduleResolve (internal/modules/esm/resolve.js:705:18)
at Loader.defaultResolve [as _resolve] (internal/modules/esm/resolve.js:819:11)
at Loader.resolve (internal/modules/esm/loader.js:89:40)
at Loader.getModuleJob (internal/modules/esm/loader.js:242:28)
at ModuleWrap.<anonymous> (internal/modules/esm/module_job.js:73:40)
at link (internal/modules/esm/module_job.js:72:36) {
code: 'ERR_MODULE_NOT_FOUND'
}
I currently have no clue how to fix this because every tutorial I've seen on the internet does the exact same.
I hope someone can help me with this.
Upvotes: 1
Views: 1372