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

We detected an application built with production configuration. Angular DevTools only supports development build. #56399

Closed
1 of 2 tasks
sbma24 opened this issue Jun 12, 2024 · 2 comments

Comments

@sbma24
Copy link

sbma24 commented Jun 12, 2024

Is this a bug report or a feature request?

  • Bug Report
  • Feature Request

Please provide the steps to reproduce the issue [Bug Report only]

I use a nx-workspace (nx Version 18.2.0) and I don't have an angular.json. Within the angular app is only a project.json which replaces the angular.json and contains all configurations of the angular project.

I serve the angular app with the dev-configuration but I always get the message: "We detected an application built with production configuration. Angular DevTools only supports development build." with the notification "A dev build is when the optimization flag is set to false in the angular.json config file." in the console.

image

The development config of the project.json set optimization to false:
"configurations": { "production": { "optimization": { "fonts": true, "styles": true, "scripts": true }, "development": { "buildOptimizer": false, "optimization": false, "vendorChunk": true, "extractLicenses": false, "sourceMap": true, "namedChunks": true } },

Please provide the expected behavior vs the actual behavior you encountered [Bug Report only]

Angular DevTools should see that this is a dev environment and work.

Please provide a screenshot if possible [Bug Report only]

No response

Please provide the exception or error you saw [Bug Report only]

No response

Is this a browser-specific issue? If so, please specify the device, browser, and version. [Bug Report only]

No response

Description [Feature Request only]

No response

Proposed solution [Feature Request only]

No response

Alternatives considered [Feature Request only]

No response

@JeanMeche
Copy link
Member

Check you console, if your application doesn't expose a ng global, then your app is not in developement mode.
Do you maybe have a enableProdMode() call in your app ?

@sbma24
Copy link
Author

sbma24 commented Jun 12, 2024

Thank you @JeanMeche.

In the main.ts, the enableProdMode() is called but there was an error in my if-statement. There I checked if the value of the .env-File is true. But it's a string and it always ran into true.


if (process.env['NX_PRODUCTION']) {
  enableProdMode();
}

So I changed the statement now and I explicitly check whether process.env['NX_PRODUCTION'] equals string 'true'

if (process.env['NX_PRODUCTION'] === 'true') {
  enableProdMode();
}

@sbma24 sbma24 closed this as completed Jun 12, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants