I have created a NX monorepo workspace in which I have a nx.json file and a project.json for each library in the “libs” folder. Since I used the latest version of NX (@nx/angular 19.4.4) I don’t have any workspace.json nor angular.json file in my workspace.
When I try to build the whole project I get the following warnings:
Warning: /<my-workspace>/libs/layout/src/lib/components/panel/panel.component.scss exceeded maximum budget. Budget 2.05 kB was not met by 1.55 kB with a total of 3.60 kB.
Warning: /<my-workspace>/libs/messenger/src/lib/components/messages-viewer/messages-viewer.component.scss exceeded maximum budget. Budget 2.05 kB was not met by 122 bytes with a total of 2.17 kB.
Warning: bundle initial exceeded maximum budget. Budget 512.00 kB was not met by 938.53 kB with a total of 1.45 MB.
As far as I know I should add settings like the following to the project.json file of the library that triggered the warning
"budgets": [
{
"type": "initial",
"maximumWarning": "1mb",
"maximumError": "2mb"
}
]
In this way:
"targets": {
"build": {
"executor": "@nx/angular:package",
"outputs": ["{workspaceRoot}/dist/{projectRoot}"],
"options": {
"project": "libs/messenger/ng-package.json"
},
"configurations": {
"production": {
"tsConfig": "libs/messenger/tsconfig.lib.prod.json",
"budgets": [
{
"type": "initial",
"maximumWarning": "1mb",
"maximumError": "2mb"
}
]
},
"development": {
"tsConfig": "libs/messenger/tsconfig.lib.json"
}
},
"defaultConfiguration": "production"
},
...
}
But if I do that I get the following error:
NX ‘budgets’ is not found in schema
Instead having the same property in the project.json of any app (not library) of the same monorepo workspace doesn’t throw the error above.
Why??? What does it mean?