nrwl / nx

Smart Monorepos · Fast CI
https://nx.dev
MIT License
23.2k stars 2.3k forks source link

`nx` creates `tsconfig.json` then looks for `tsconfig.base.json` for Angular project #14379

Closed 4javier closed 1 year ago

4javier commented 1 year ago

Current Behavior

On creation from scratch of a new workspace, the system generates tsconfig.json but on serve Angular builder looks for tsconfig.base.json

[javier@ThinkArch showroom]$ npx create-nx-workspace showroom
[javier@ThinkArch showroom]$ ls -a | grep "tsconfig"
tsconfig.app.json
tsconfig.editor.json
tsconfig.json
tsconfig.spec.json

on app generation there's the same problem:

[javier@ThinkArch showroom]$ npx nx g @nrwl/angular:host shell
[javier@ThinkArch shell]$ ls -a | grep "tsconfig"
tsconfig.app.json
tsconfig.json
tsconfig.editor.json
tsconfig.spec.json
[javier@ThinkArch showroom]$ npx nx serve shell
 >  NX   NX MF: TsConfig Path for workspace libraries does not exist! (/mnt/dati/VSCode_workspace/nx-apps/showroom/tsconfig.base.json).

No global ng-cli installed

[javier@ThinkArch showroom]$ ng
bash: ng: command not found

Expected Behavior

I'd expect nx generators to create tsconfig.base.json instead of tsconfig.json

Github Repo

No response

Steps to Reproduce

1.Just create an Angular workspace from scratch

Nx Report

   Node : 14.20.0
   OS   : linux x64
   npm  : 6.14.17

   nx : 15.5.1
   @nrwl/angular : 15.5.1
   @nrwl/cypress : 15.5.1
   @nrwl/detox : Not Found
   @nrwl/devkit : 15.5.1
   @nrwl/esbuild : Not Found
   @nrwl/eslint-plugin-nx : 15.5.1
   @nrwl/expo : Not Found
   @nrwl/express : Not Found
   @nrwl/jest : 15.5.1
   @nrwl/js : 15.5.1
   @nrwl/linter : 15.5.1
   @nrwl/nest : Not Found
   @nrwl/next : Not Found
   @nrwl/node : Not Found
   @nrwl/nx-cloud : Not Found
   @nrwl/nx-plugin : Not Found
   @nrwl/react : Not Found
   @nrwl/react-native : Not Found
   @nrwl/rollup : Not Found
   @nrwl/schematics : Not Found
   @nrwl/storybook : Not Found
   @nrwl/web : Not Found
   @nrwl/webpack : 15.5.1
   @nrwl/workspace : 15.5.1
   @nrwl/vite : Not Found
   typescript : 4.8.4
   ---------------------------------------
   Local workspace plugins:
   ---------------------------------------
   Community plugins:

Failure Logs

No response

Additional Information

Renaming the files and fix extendings in their child makes everything work as expected.

AgentEnder commented 1 year ago

I just created a workspace and it created with tsconfig.base.json. Can you provide the commands and choices from prompts that got you to tsconfig.json?

4javier commented 1 year ago
[javier@ThinkArch test]$ npx create-nx-workspace test
npx: installato 67 in 34.606s

 >  NX   Let's create a new workspace [https://nx.dev/getting-started/intro]

✔ Choose what to create                 · angular
✔ Default stylesheet format             · scss
✔ Enable distributed caching to make your CI faster · No

 >  NX   Nx is creating your v15.5.1 workspace.

   To make sure the command works reliably in all environments, and that the preset is applied correctly,
   Nx will run "npm install" several times. Please wait.

✔ Installing dependencies with npm
✔ Nx has successfully created the workspace: test.
[javier@ThinkArch test]$ ls -a | grep tsconfig
tsconfig.app.json
tsconfig.editor.json
tsconfig.json
tsconfig.spec.json
AgentEnder commented 1 year ago

Ah! This is for the standalone angular selection right? Its possible thats not fully supported by the generated MF setup.

4javier commented 1 year ago

Ah! This is for the standalone angular selection right? Its possible thats not fully supported by the generated MF setup.

I used that because it's the one suggested in docs for Module Federation MicroFrontEnds setup. https://nx.dev/recipes/module-federation/dynamic-module-federation-with-angular#create-an-nx-workspace But I noticed it creates a src/app default application, configuring Jest for it. Since the purpose is to later create shell and remotes, that default project looks useless. Presets are a bit confusing: which one would best fit for a monorepo already setup to host an Angular Microfrontend architecture with Module Federation, with Jest, ESLint and Cypress, but without default app?

Coly010 commented 1 year ago

The docs need updated.

Thanks for bringing this to my attention.

The one you want is integrated -> angular

I'll update the docs to highlight this now that our prompts have changed, but likewise, the MF helpers should handle tsconfig.json at root

github-actions[bot] commented 1 year ago

This issue has been closed for more than 30 days. If this issue is still occuring, please open a new issue with more recent context.