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

nx serve doesn't respect "buildLibsFromSource" (reopen) #9027

Closed
ziacik opened this issue Feb 18, 2022 · 4 comments
Closed

nx serve doesn't respect "buildLibsFromSource" (reopen) #9027

ziacik opened this issue Feb 18, 2022 · 4 comments
Labels
outdated scope: react Issues related to React support for Nx stale type: bug

Comments

@ziacik
Copy link
Contributor

ziacik commented Feb 18, 2022

Since the original issue #8942 got closed, I've got some new info and I don't think my comment will be noticed there, I'm filing a new issue. Apologies if this is not the correct approach.

The original issue got closed with an advice to use @nrwl/web:file-server, but I think this should work with dev-server too.

Looking at the code here

buildOptions.tsConfig = createTmpTsConfig(

it looks like the dev-server actually tries to handle this situation by generating a temporary tsconfig with paths remapped.
But the generated tsconfig doesn't seem to be actually used later on and that - I think - is why the serve fails.


As for the @nrwl/web:file-server executor, I tried to use it, but ran into some other problems. Because of defaultConfiguration=production, the serve target builds production configuration, though I need a development one during serve. I can overcome that by introducing explicit development configuration, but then also NODE_ENV is set to production by webpack plugin, so I have to explicitly set it before calling nx serve. Not quite developer-friendly.

Current Behavior

I have an app with strict:true setting, which uses a lib which is non-strict. To be able to build the app, I've set "buildLibsFromSource": false in the app config. That allows me to run nx build app without an error. But nx serve app still shows errors as if the lib was built during the serve - in strict mode.

Expected Behavior

nx serve app should use the independently built lib sources and finish without error, just like nx build app does.

Steps to Reproduce

  1. create a workspace with a @nrwl/web:application and a buildable non-strict @nrwl/node:library.
  2. make the app strict in its tsconfig.
  3. add a code to the library that does something that wouldn't build in strict mode.
  4. use the library in the app
  5. set the "buildLibsFromSource" to false in app's project.json
  6. run nx serve app

Repro repo:
https://github.com/ziacik/nx-bug-2

Environment

>  NX   Report complete - copy this into the issue template

   Node : 14.17.6
   OS   : linux x64
   npm  : 6.14.15
   
   nx : undefined
   @nrwl/angular : undefined
   @nrwl/cli : 13.8.1
   @nrwl/cypress : 13.8.1
   @nrwl/detox : undefined
   @nrwl/devkit : 13.8.1
   @nrwl/eslint-plugin-nx : 13.8.1
   @nrwl/express : undefined
   @nrwl/jest : 13.8.1
   @nrwl/js : 13.8.1
   @nrwl/linter : 13.8.1
   @nrwl/nest : undefined
   @nrwl/next : undefined
   @nrwl/node : 13.8.1
   @nrwl/nx-cloud : undefined
   @nrwl/react : undefined
   @nrwl/react-native : undefined
   @nrwl/schematics : undefined
   @nrwl/storybook : undefined
   @nrwl/tao : 13.8.1
   @nrwl/web : 13.8.1
   @nrwl/workspace : 13.8.1
   typescript : 4.5.5
   rxjs : 6.6.7
   ---------------------------------------
   Community plugins:
@FrozenPandaz FrozenPandaz added the scope: react Issues related to React support for Nx label Mar 14, 2022
@FrozenPandaz
Copy link
Collaborator

Thank you for providing the reproduction. We'll take a look.

@ms-tng
Copy link
Contributor

ms-tng commented Mar 21, 2022

I fixed it in this PR: #9326

@github-actions
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! 🙏

@github-actions
Copy link

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 Mar 21, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
outdated scope: react Issues related to React support for Nx stale type: bug
Projects
None yet
Development

No branches or pull requests

3 participants