I tried renaming my ang…

2 minute read

I tried renaming my angular.json to workspace.json because I don’t want to have my root workspace be “Angular-centric” (I want to be welcoming to suspicious React developers). However, the code that attempts to load the workspace file explicitly loads angular.json if it sees that angular cli is in your packages.


maybe try creating a nx workspace instead of trying to rework an angular workspace?

Hm, would think all of that would be encapsulated in the workspace file – there was nothing in nx.json that I could see that needed to be switched.

nx creates a workspace.json file or an angular.json file, I dont think they are the same internal files, maybe try creating a blank workspace without angular and look into the workspace.json file?

My point was debugging into the code that attempts to load either a workspace.json or the angular.json is it will always attempt to load the angular.json(and fail) if angular cli is one of the packages.

so, before it reads either file

ah okay

This is in 9.1; not sure if 9.2 is a little more flexible

! User ergonomics! :stuck_out_tongue:

, I tried the same thing for the same reason. There is definitely a use case for this migration.

I successfully have done this. You just need to make sure you update the reference in nx.json as well.

duh… should have just searched the repo for angular.json

No worries, theses steps should probably be added to the Nx documentation.

I did the contary, switching from workspace.json to angular.json because ionic is looking for angular.json :smile:

That’s good to know, are there any pros / cons of angular.json vs workspace.json?

Well for one I think it’s more palatable to a non-Angular team since they don’t have to use the Angular CLI. Otherwise I think you should have a very similar experience just with slightly different syntax.

I am guessing there will be more features added to the CLI in the future

yep the “non-Angular” use case was the original motivation for workspace.json. It’s possible in the future, new features (like partitioning config into multiple files) would only work with workspace.json, but don’t quote me on that

where in nx.json would one change that?

{ "npmScope": "myorg", "implicitDependencies": { "workspace.json": "*", "package.json": { "dependencies": "*", "devDependencies": "*" }, "tsconfig.json": "*", "tslint.json": "*", "nx.json": "*" }, "projects": { ... } }

It looks like yours is configured for workspace.json. I believe that if you generate a workspace with the Angular CLI then that would say angular.json in place of workspace.json.

hey Jason, how does Nx know to look for angular.json or workspace.json?

I.e. is there a way to change it after the fact