-
Notifications
You must be signed in to change notification settings - Fork 12k
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
Name Mangling issue in production builds #6722
Comments
+1 |
In order to achieve this you will have to The CLI team is working on a way to allow incremental changes to the existing build process without having to eject but that level of granularity is not ready yet. See comment on #5192. Hope that helped! |
@jgodi is correct, this is only possible via ejecting. The goal of the CLI is to create small production builds and not renaming would create larger bundles. |
We really need this feature because of code healthy and maintainability. |
I don't think this is a valid argument. I keep on seeing it over and over, but how much of a difference would it make to keep the class names, if the project owner requires the functionality? Surely that is up the to developer, and not the Angular CLI to decide? |
This issue has been automatically locked due to inactivity. Read more about our automatic conversation locking policy. This action has been performed automatically by a bot. |
Name mangling is enabled in production builds, this can be a problem because it changes the class names that can be used as tokens inside our code or in Angular dependency injection.
We cannot use things like: class.constructor.name in our code.
Versions.
@angular/cli: 1.1.2
node: 7.10.0
os: win32 x64
@angular/animations: 4.2.3
@angular/common: 4.2.3
@angular/compiler: 4.2.3
@angular/core: 4.2.3
@angular/forms: 4.2.3
@angular/http: 4.2.3
@angular/platform-browser: 4.2.3
@angular/platform-browser-dynamic: 4.2.3
@angular/router: 4.2.3
@angular/cli: 1.1.2
@angular/compiler-cli: 4.2.3
@angular/language-service: 4.2.3
Repro steps.
The log given by the failure.
The output will be:
as you can see the class was renamed.
Desired functionality.
The output should be:
which is correct output in tests and non production builds
Mention any other details that might be useful.
Lokking at how Angular does their builds it seems to me thay have disabled name mangling at all:
https://github.com/angular/angular/blob/fd72fad8fd334774162dd89ffcd8dc3e4e5ce21a/aio/content/examples/webpack/config/webpack.prod.js
look at line 24
As an additional question:
is there a way in Angular CLI to run the tests with the production build code (not just using the production environment configuration), so I can setup a proper Unit Test to catch the issue?
The text was updated successfully, but these errors were encountered: