'How load all assets in nx's lib used in many apps?
I want to figure out how to add assets to nx angular lib and do not repeat this declaration in each app:
{
"glob": "**/*",
"input": "libs/feature-a/feature-a-core/src/assets/icons",
"output": "assets/feature-a/icons"
}
I tried to use ng-packagr in lib and add "assets": ["./src/assets"] to ng-package.json but it doesn't work.
I also tried import icons in lib's module by require.context from webpack-env and it also doesn't work.
Do you have any idea how to reduce this Boilerplate?
project.json of lib:
{
"projectType": "library",
"root": "libs/feature-a/feature-a-core",
"sourceRoot": "libs/feature-a/feature-a-core/src",
"targets": {
"build": {
"options": {
"executor": "@nrwl/angular:package",
"tsConfig": "libs/feature-a/feature-a-core/tsconfig.lib.json",
"project": "libs/feature-a/feature-a-core/ng-package.json",
"assets": [
{
"glob": "**/*",
"input": "libs/feature-a/feature-a-core/src/assets/icons",
"output": "assets/feature-a/icons"
}
],
"configurations": {
"production": {
"tsConfig": "libs/feature-a/feature-a-core/tsconfig.lib.prod.json"
}
}
}
},
}
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
