SASS import breaks when using Angular Universal

An example of an app available for download that shows the problem:

https://github.com/chrillewoodz/ng-boilerplate/tree/universal

I'm trying to get angular generic to work, but it throws an error to import SCSS in one of the SCSS components of the files:

@import './src/assets/styles/utils/_exports';

      

It works normally without a generic, but when it works with a generic, it treats imports as being component-relative, not root.

So the path will be as follows:

src/app/shared/components/breadcrumbs/src/assets/styles/utils

      

Instead:

src/assets/styles/utils

      

How can I set the path so that it works in both scenarios?

I did some things but couldn't find similar problems, the only problems that came up is that SASS doesn't work as expected with generic and AOT. Which would be a completely separate issue once I manage to resolve this issue.

+3


source to share


1 answer


you need to check the base which is in the tsconfig.app.json file , so the path must be relative to this "baseUrl": " , path.if you need your path as" src / assets / styles / utils ", you need to change the " baseUrl " ":" / src " from" src / assets / styles / utils ". please share your tsconfig.app.json as the asset is parallel to it or could be your folder structure. As you need to check your SCSS file against the object to which you want to access.



0


source







All Articles