2

I have a weird problem with WebCompiler when i'm trying to import other scss files. None of my colleagues has this problem within my team and we have no idea what causes this so i hope you may be able to help me.

We have imports like this:

@import "node_modules/bootstrap/scss/bootstrap";

In multiple files but VS 2019 throws me this exception after the latest update:

Error: File to import not found or unreadable: node_modules/...

I tried to:

  1. Reinstall WebCompiler.
  2. Let Visual Studio recreate the %localappdata%\temp\WebCompiler1.X folder(s) (I have 2 folders for WebCompiler for some reason and everytime i'm letting VS recreate them it generates both of them.)

The files that it mentions in the error message are definitely exists so i think it simply can't read them but i have no idea why.

1 Answers1

1

I had the same error. But I was able to fix it by adding "node_modules" to my includePath into my compilerconfig.json.defaults file - in the sass section:

"sass": {
  ...
  "includePath": "node_modules",
  ...
}

Then you can remove the node_modules path from the import path. ie:

@import "carbon-components/scss/globals/scss/_css--reset";

If you dont have a defaults file, you can also do it per file in the compilerconfig.json:

[
  {
     "outputFile": "Scss/Carbon.css",
     "inputFile": "Scss/Carbon.scss",
     "options": {
         "includePath": "node_modules"
      }
  }
]

I hope it works for you :)

dalcam
  • 1,027
  • 11
  • 28