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

Generated nestjs app is served with node-env=production, no debugging and no sourcemaps #22880

Closed
1 of 4 tasks
johnwest80 opened this issue Apr 18, 2024 · 4 comments
Closed
1 of 4 tasks
Labels
outdated scope: node Issues related to Node, Express, NestJS support for Nx type: bug

Comments

@johnwest80
Copy link

Current Behavior

I created a brand new nx workspace with nestjs preset. When running npx nx serve nestjsapp, webpack builds it in production mode.

Expected Behavior

It should be served with sourcemaps and debugging enabled.

GitHub Repo

No response

Steps to Reproduce

Easy... just create a new workspace with the nest preset and serve it. you'll see that webpack is incorrectly serving in production mode.

  1. npx create-nx-workspace@latest nx-test-3 --preset=nest
  2. Used app name of nx-test-3, no dockerfile, no nx cloud
  3. npx nx serve nx-test-3

when you serve it, this is what you see... note that webpack-clik shows node-env=production, i think it should be using tsc instead of webpack, but if it is supposed to be using webpack, it shouldn't be using production mode.


> nx run nx-test-3:serve:development


> nx run nx-test-3:build

> webpack-cli build --node-env=production

chunk (runtime: main) main.js (main) 2.71 KiB [entry] [rendered]
webpack compiled successfully (f60f6de829567d37)

———————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————

 NX   Successfully ran target build for project nx-test-3 (7s)

Debugger listening on ws://localhost:9229/b0251ed6-b476-48ed-a033-7eed915c436e
Debugger listening on ws://localhost:9229/b0251ed6-b476-48ed-a033-7eed915c436e
For help, see: https://nodejs.org/en/docs/inspector

[Nest] 86378  - 04/18/2024, 8:13:52 AM     LOG [NestFactory] Starting Nest application...
[Nest] 86378  - 04/18/2024, 8:13:52 AM     LOG [InstanceLoader] AppModule dependencies initialized +32ms
[Nest] 86378  - 04/18/2024, 8:13:52 AM     LOG [RoutesResolver] AppController {/api}: +5ms
[Nest] 86378  - 04/18/2024, 8:13:52 AM     LOG [RouterExplorer] Mapped {/api, GET} route +3ms
[Nest] 86378  - 04/18/2024, 8:13:52 AM     LOG [NestApplication] Nest application successfully started +6ms
[Nest] 86378  - 04/18/2024, 8:13:52 AM     LOG 🚀 Application is running on: http://localhost:3000/api



### Nx Report

```shell
>  NX   Its time to update Nx 🎉

   Your repository uses a higher version of Nx (18.3.1) than your global CLI version (17.1.2)
   For more information, see https://nx.dev/more-concepts/global-nx


 NX   Report complete - copy this into the issue template

Node   : 18.17.1
OS     : darwin-x64
npm    : 9.6.7

nx (global)        : 17.1.2
nx                 : 18.3.1
@nx/js             : 18.3.1
@nx/jest           : 18.3.1
@nx/linter         : 18.3.1
@nx/eslint         : 18.3.1
@nx/workspace      : 18.3.1
@nx/devkit         : 18.3.1
@nx/eslint-plugin  : 18.3.1
@nx/nest           : 18.3.1
@nx/node           : 18.3.1
@nrwl/tao          : 18.3.1
@nx/web            : 18.3.1
@nx/webpack        : 18.3.1
typescript         : 5.4.5
---------------------------------------
Registered Plugins:
@nx/webpack/plugin
@nx/eslint/plugin
@nx/jest/plugin

Failure Logs

none

Package Manager Version

No response

Operating System

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

Additional Information

image

@AgentEnder AgentEnder added the scope: node Issues related to Node, Express, NestJS support for Nx label Apr 29, 2024
@AgentEnder
Copy link
Member

You should be able to specify --configuration development or set a defaultConfiguration in the project.json if you'd like that to be the default.

@stijnstroeve
Copy link

That does not seem to be it @AgentEnder, even with the configuration set to development the node-env=production seems to be set.

@abdelrahman-essawy
Copy link

I can confirm I'm facing the same problem.

 NX   Report complete - copy this into the issue template

Node   : 20.10.0
OS     : win32-x64
pnpm   : 9.0.6

nx (global)        : 18.0.4
nx                 : 18.3.4
@nx/js             : 18.3.4
@nx/jest           : 18.3.4
@nx/eslint         : 18.3.4
@nx/workspace      : 18.3.4
@nx/cypress        : 18.3.4
@nx/eslint-plugin  : 18.3.4
@nx/nest           : 18.3.4
@nx/node           : 18.3.4
@nrwl/tao          : 18.0.4
@nx/vite           : 18.3.4
@nx/vue            : 18.3.4
@nx/web            : 18.3.4
@nx/webpack        : 18.3.4
typescript         : 5.4.5
---------------------------------------
Registered Plugins:
@nx/eslint/plugin
@nx/vite/plugin
@nx/cypress/plugin
@nx/webpack/plugin
@nx/jest/plugin
---------------------------------------
The following packages should match the installed version of nx
  - @nrwl/[email protected]

To fix this, run `nx migrate [email protected]`

Copy link

github-actions bot commented Jun 2, 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 Jun 2, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
outdated scope: node Issues related to Node, Express, NestJS support for Nx type: bug
Projects
None yet
Development

No branches or pull requests

4 participants