-1

I have been working on a project for months and I have the following jsconfig.json file to make loading paths easier. I don't believe there's anything wrong with this config because it has been working for the entire length of the project, but here it is for reference:

{
  "compilerOptions": {
    "baseUrl": ".",
    "paths": {
      "@/*": ["./src/*"],
      "@/public/*": ["./public/*"],
      "@/styles/*": ["./src/styles/*"],
      "@/utils/*": ["./src/utils/*"],
      "@/components/*": ["./src/components/*"]
    }
  }
}

And today, seemingly for no reason, I'm getting random modules that cannot be found. The example at the time of making this post, in the following screenshot, you can see that the @/utils/craft/client path worked absolutely fine, but the following module on line 4 throws an error.

enter image description here

As you can see in the following screenshot, the naming and file path matches exactly.

enter image description here

The fact it worked for ages and has thrown this error now out of the blue, suggests to me this a VSCode/jsconfig bug and not actually with the markup itself?

Any help would be appreciated.

juliomalves
  • 42,130
  • 20
  • 150
  • 146
Jay
  • 326
  • 2
  • 18
  • Good job finding the solution. Your question post is still expected to be high-quality though. Please provide a [mre] with text and not images of text. – starball Feb 15 '23 at 18:56

1 Answers1

1

Found the issue.

I accidentally labelled a file .tsx and when I ran npm run build, a tsconfig file was automatically added. This meant that the jsconfig file was no longer being used!

Jay
  • 326
  • 2
  • 18
  • 1
    I did the same thing! Did you fix the issue though? Because is stuck with the problem. I even delete .next folder but it's still not working. Edit: forgot to delete the new tsconfig.json – skypower Feb 28 '23 at 11:43
  • Hey, glad to see you resolved it! – Jay Mar 01 '23 at 06:41