1

I have a fresh Next.js project with a clean set of jsconfig declarations as per:

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

Yet, out of nowhere, they're now returning Can't resolve 'styles/styles.scss' and I can't identify what has changed. What's the best way to debug this to find the cause, or what are some common causes for this?

Jay
  • 326
  • 2
  • 18

1 Answers1

0

There are a few things you can try to debug the issue.

  1. Make sure that the file 'styles/styles.scss' exists in your project and that the file path is spelled correctly in your jsconfig declarations.

  2. Check your dependencies and make sure that you have all the necessary packages, such as 'node-sass' or 'sass-loader', installed and configured correctly.

  3. Check if there are any conflicting configurations or settings in your webpack config file that may be causing the issue.

  4. Check your package.json file, if you are using any package or tool that is transforming your scss files, make sure that it is configured correctly and that the package is up to date.

  5. Check if there are any other error messages in your console, they may be related to the problem and provide more information.

If none of the above works, try re-creating the project from scratch and see if that resolves the issue. Hope this helps!

RyanL33
  • 1
  • 4
  • Thanks for your response. It's actually not a Sass-related issue, because if I comment out the erroring sass file, the next import errors with the same message, and that's a jsx component, so it's something to do with the jsconfig not being read. – Jay Jan 26 '23 at 04:01
  • Ok, thanks for clarifying. I ran into a similar problem having my jsconfig setup the way you currently have it setup. Here's what solved the problem for me with the React project I'm currently working on. Maybe it'll help you as well: `{ "compilerOptions": { "baseUrl": "src" }, "include": ["src"] }` – RyanL33 Jan 26 '23 at 11:23
  • @Jay Did my previous comment help you at all? – RyanL33 Jan 28 '23 at 02:17
  • Wasn't able to resolve it I'm afraid. Currently building a fresh Next app and copying the src contents over. – Jay Jan 28 '23 at 11:08