Angular Universal: SCSS imports in Components

Angular Universal: SCSS imports in Components

Error: Module build failed (from ./node_modules/sass-loader/dist/cjs.js): SassError: Can't find stylesheet to import.

When using angular universal, if you set up your SCSS as you would normally do, you would add in angular.json in projects/architect/build/options the following property:

"stylePreprocessorOptions": {
          "includePaths": ["src/styles"]
        }

But whenever you try to import a scss stylesheet in your components, you will get the following error: Error: Module build failed (from ./node_modules/sass-loader/dist/cjs.js): SassError: Can't find stylesheet to import.

In order to fix this, you need to add the above property again, in your angular.json file the object found at projects/architect/server/options