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

Build optimization breaks my library code #13768

Closed
richardlnnr opened this issue Feb 25, 2019 · 3 comments · Fixed by #13871
Closed

Build optimization breaks my library code #13768

richardlnnr opened this issue Feb 25, 2019 · 3 comments · Fixed by #13871

Comments

@richardlnnr
Copy link

richardlnnr commented Feb 25, 2019

🐞 Bug report

Command (mark with an x)

- [ ] new
- [ x ] build
- [ x ] serve
- [ ] test
- [ ] e2e
- [ ] generate
- [ ] add
- [ ] update
- [ ] lint
- [ ] xi18n
- [ ] run
- [ ] config
- [ ] help
- [ ] version
- [ ] doc

Is this a regression?

Not sure.

Description

I created a workspace with two projects.

main-app is an application that is responsible for running the library.
domain is a library that has classes and utility methods.

When I build main-app in production (optimization=true), my utility function in domain library doesn't work.

Apparently, the problem only happens when you export arrow functions.

🔬 Minimal Reproduction

I created a repository in GitHub to reproduce this error.

🌍 Your Environment


Angular CLI: 7.3.2
Node: 10.15.1
OS: win32 x64
Angular: 7.2.6
... animations, common, compiler, compiler-cli, core, forms
... language-service, platform-browser, platform-browser-dynamic
... router

Package                            Version
------------------------------------------------------------
@angular-devkit/architect          0.13.2
@angular-devkit/build-angular      0.13.2
@angular-devkit/build-ng-packagr   0.13.2
@angular-devkit/build-optimizer    0.13.2
@angular-devkit/build-webpack      0.13.2
@angular-devkit/core               7.3.2
@angular-devkit/schematics         7.3.2
@angular/cli                       7.3.2
@ngtools/json-schema               1.1.0
@ngtools/webpack                   7.3.2
@schematics/angular                7.3.2
@schematics/update                 0.13.2
ng-packagr                         4.7.1
rxjs                               6.3.3
typescript                         3.2.4
webpack                            4.29.0

Anything else relevant?

@filipesilva
Copy link
Contributor

Heya, can you elaborate on what doesn't work means in this context please? Does it return the wrong result, not run at all, or something else?

@filipesilva filipesilva added type: bug/fix needs: more info Reporter must clarify the issue labels Feb 28, 2019
@richardlnnr
Copy link
Author

richardlnnr commented Feb 28, 2019

When I export a function using arrow functions, apparently, the compiler ignores the code inside the function.

In the repository, I create the same code using the arrow function and a non-arrow function.
Just running the ng serve --prod is possible to see both functions called, and just remapWithoutArrowFunction working.

Those are the functions remand and remapWithoutArrowFunction

@angular-automatic-lock-bot
Copy link

This issue has been automatically locked due to inactivity.
Please file a new issue if you are encountering a similar or related problem.

Read more about our automatic conversation locking policy.

This action has been performed automatically by a bot.

@angular-automatic-lock-bot angular-automatic-lock-bot bot locked and limited conversation to collaborators Sep 9, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants