Hello everyone happy New Year 2022! I'm currently working on my angular library and I have two issues I seem unable to fix despite the documentations and the time I've spent looking for a solution. This is what I'm trying to achieve:
- I'd like to setup a main entrypoint inside my angular lib so the link is cleaner
- I'd like to use styleIncludePaths from ng-packagr in order to shorten my SCSS imports
This is what my current architecture looks like:
// ng-package.json
{
"$schema": "../../node_modules/ng-packagr/ng-package.schema.json",
"dest": "../../dist/core",
"lib": {
"entryFile": "src/public-api.ts",
"styleIncludePaths": [
"./src/lib/scss"
]
},
"assets": [
"./src/lib/scss"
]
}
// package.json
"name": "@ngx-chrono-ui-kit/core",
...
"exports": {
".": {
"sass": "./lib/scss/_index.scss"
}
}
So I'm currently calling my lib this way (the 'src' folder doesn't exist in the dist):
@import '~@ngx-chrono-ui-kit/core/lib/scss';
But I'd like to change it so it looks like this:
@import '~@ngx-chrono-ui-kit/core';
Sadly, with the above configuration it does not work:
Second, in my components (i.e: components/ActionBar/action-bar.component.scss) I'm calling SCSS definitions that I have defined in my SCSS folder:
@use '../../scss/abstracts/variables' as variables;
@use '../../scss/abstracts/colors' as colors;
@use '../../scss/abstracts/typography' as typography;
@use '../../scss/abstracts/mixins' as mixins;
@use '../../scss/abstracts/functions' as functions;
I would like to shorten the links so they look like this:
@use 'abstracts/variables' as variables;
@use 'abstracts/colors' as colors;
@use 'abstracts/typography' as typography;
@use 'abstracts/mixins' as mixins;
@use 'abstracts/functions' as functions;
But my IDE actually warns me that it cannot resolve the imports (and while building, it does not work as well):
Please if you're seeing an error in my configuration feel free to react