We've inherited a Next + TypeScript site from another developer and we're trying to create a new component that's based very heavily from one that already exists. I've copied the entire component and sub folders to the same level as the existing one, but if I then change the reference to the cloned folder, I get the "Module not found: Can't resolve" error:
import { MyModule } from '@project-root/shared/foo/bar/old/module';
works, but
import { MyModule } from '@project-root/shared/foo/bar/new/module';
in the same file, doesn't. But the contents of the 'new' folder is directly copied from the 'old' folder.
I've copied the reference to the path to the tsconfig.base.json and restarted but it's not being found:
"@project-root/shared/foo/bar/old/module": [
"libs/shared/foo/bar/old/module/src/index.ts"
],
"@project-root/shared/foo/bar/new/module'": [
"libs/shared/foo/bar/new/module/src/index.ts"
],
What's the cause of the issue, and how can it be resolved?
tsc --traceResolution
but that just returned the same error that I'm seeing in the code editor:error TS2307: Cannot find module '@project-root/shared/foo/bar/new/module' or its corresponding type declarations.
Not sure if that helps see what's going on?