Add this to nx.json
"@nrwl/js": {
"analyzeSourceFiles": true
}
}
And this two options to build target (I'm using @nrwl/web:rollup) in the project.json:
"updateBuildableProjectDepsInPackageJson": true,
"buildableProjectDepsInPackageJsonType": "dependencies"