Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Webpack (and other executors) use the current target when generating a temporary tsconfig. #21395

Closed
1 of 4 tasks
statop opened this issue Jan 29, 2024 · 7 comments
Closed
1 of 4 tasks

Comments

@statop
Copy link

statop commented Jan 29, 2024

Current Behavior

If I use @nx/webpack:webpack in a target other than 'build' with buildLibsFromSource: false then it will use that other target when calculating the dependencies for generating the temporary tsonfig.

Expected Behavior

If I use @nx/webpack:webpack in a target other than 'build' with buildLibsFromSource: false then it will use the 'build' target when calculating the dependencies for generating the temporary tsonfig.

GitHub Repo

No response

Steps to Reproduce

  1. use @nx/webpack:webpack in a target other than 'build' with buildLibsFromSource: false

Note that the temporary tsconfig only contains mappings to the dist folder to dependencies that also have that target.

Nx Report

>  NX   Report complete - copy this into the issue template

   Node   : 18.17.1
   OS     : darwin-arm64
   pnpm   : 8.14.3

   nx                 : 17.2.8
   @nx/js             : 17.2.8
   @nx/jest           : 17.2.8
   @nx/eslint         : 17.2.8
   @nx/workspace      : 17.2.8
   @nx/angular        : 17.2.8
   @nx/devkit         : 17.2.8
   @nx/eslint-plugin  : 17.2.8
   @nx/node           : 17.2.8
   @nx/plugin         : 17.2.8
   @nx/react          : 17.2.8
   @nx/rollup         : 17.2.8
   @nx/storybook      : 17.2.8
   @nx/vite           : 17.2.8
   @nx/web            : 17.2.8
   @nx/webpack        : 17.2.8
   typescript         : 5.2.2
   ---------------------------------------
   Community plugins:
   @openadp/tools-plugin : 24.5.0
   @storybook/angular    : 7.6.10
   ---------------------------------------
   Local workspace plugins:
   	 @openadp/tools-plugin

Failure Logs

No response

Package Manager Version

pnpm 8.14.3

Operating System

  • macOS
  • Linux
  • Windows
  • Other (Please specify)

Additional Information

This problem exists with any executor that uses temporary tsconfigs.

The webpack dev server does this correctly, https://github.com/nrwl/nx/blob/master/packages/webpack/src/executors/dev-server/dev-server.impl.ts#L57

Alternatively, there needs to be a way to tell the executor what build target to use for calculating dependencies.

@leosvelperez leosvelperez self-assigned this Jan 30, 2024
@leosvelperez leosvelperez added the scope: misc Misc issues label Jan 30, 2024
@leosvelperez
Copy link
Member

Thanks for reporting this!

Could you try running the build setting the NX_BUILDABLE_LIBRARIES_TASK_GRAPH=true env var and see if it helps? We are close to switching the behavior it enables to be the default, but we'd like to get some more feedback on existing workspaces that face this issue.

@statop statop changed the title Webpack (and other executors) use the current target when generating a temporary tsconfig. Webpack (and other executors) use the current project when generating a temporary tsconfig. Jan 30, 2024
@statop statop changed the title Webpack (and other executors) use the current project when generating a temporary tsconfig. Webpack (and other executors) use the current target when generating a temporary tsconfig. Jan 30, 2024
@leosvelperez
Copy link
Member

hey @statop! 👋🏻

Have you tried running your builds with the NX_BUILDABLE_LIBRARIES_TASK_GRAPH=true env var?

@statop
Copy link
Author

statop commented Feb 13, 2024

getting errors
Screenshot 2024-02-13 at 11 54 08 AM

@leosvelperez
Copy link
Member

I see. It seems you have a project depending on another project that's not a library. That said, we have a bug and are incorrectly handling this scenario. I'm pushing a fix for that. Once it's released, I'll let you know so you can try again with the env var.

@leosvelperez
Copy link
Member

hey @statop!

The fix was released in Nx 18.0.6. Could you give it another go using that version and running your build with NX_BUILDABLE_LIBRARIES_TASK_GRAPH=true set?

Copy link

This issue has been automatically marked as stale because it hasn't had any recent activity. It will be closed in 14 days if no further activity occurs.
If we missed this issue please reply to keep it active.
Thanks for being a part of the Nx community! 🙏

Copy link

github-actions bot commented May 1, 2024

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.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators May 1, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

2 participants