Skip to content

feat(@ngtools/webpack): Allows to keep the decorators in AOT production #12179

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

Closed
wants to merge 1 commit into from
Closed

Conversation

p3x-robot
Copy link

No description provided.

@p3x-robot
Copy link
Author

it is an old feature that can only be hacked based on
angular/devkit#569 (comment)
and this gist
https://gist.github.com/p3x-robot/e12ed76acb7033638b4179149546bb73

@filipesilva
Copy link
Contributor

@p3x-robot can you provide a simple repro that shows the usecase for this change?

I remember in the past I saw a repro from you, but I think it was a big application, which makes it harder to understand.

If you can provide a simple repro it's easier to understand and could even be used for a regression test. Without a regression test there's no guarantee that the changes in this PR will continue to work in the future.

@p3x-robot
Copy link
Author

@p3x-robot
Copy link
Author

there is only like 3 stars on the gist, but for other people are having this error:
https://gist.github.com/p3x-robot/e12ed76acb7033638b4179149546bb73

@p3x-robot
Copy link
Author

if it is a big problem of adding an option to the @ngtools/webpack, i can live with the gist, so no problem, this is the 3rd time i tried to add an option that has no side effects at all, so i will not try to do it 4th time, thanks very much.

@filipesilva
Copy link
Contributor

It's not just a matter of adding an " an option that has no side effects at all". After it's added, it's part of our features and we need to maintain it. So we need to understand the problem and add tests for this scenario.

Ok, I understand the error is this one:

ERROR in : TypeError: Cannot read property 'getTsProgram' of undefined
  at AngularCompilerPlugin._getTsProgram (/home/patrikx3/Projects/patrikx3/corifeus/corifeus-app-web-pages/node_modules/@ngtools/webpack/src/angular_compiler_plugin.js:187:62)
  at getTypeChecker (/home/patrikx3/Projects/patrikx3/corifeus/corifeus-app-web-pages/node_modules/@ngtools/webpack/src/angular_compiler_plugin.js:511:43)

How can I reproduce the error and debug it myself? Can you make a simple reproduction, with the minimum of code, that triggers this error?

@p3x-robot
Copy link
Author

are you are linux/bsd or windows?

i create the simplest steps i can create given, it is an connected system (builder - for webpack latest stable and angular latest stable => create libs => create an angular app).

@filipesilva
Copy link
Contributor

I am on Windows.

@p3x-robot
Copy link
Author

git clone https://github.com/patrikx3/corifeus-builder-angular
npm install
grunt aot --disable-ng-aot-hack

This is to trigger this error.
This is a pure webpack solution since I started back on NG2.

https://github.com/patrikx3/corifeus-builder-angular/tree/master/src/config/webpack/angular
this is the webpack configs

this is the webpack ng6 solution:
https://github.com/patrikx3/corifeus-builder-angular/tree/master/test/angular-webpack
https://github.com/patrikx3/corifeus-builder-angular/blob/master/src/config/webpack/angular/prod.js

if i disable with decorators as here
https://github.com/patrikx3/corifeus-builder-angular/blob/master/src/config/webpack/angular/hack-remove-decorators.js

grunt aot
then it works. if you want to trigger again after you executed grunt aot, you have to delete the node_modules folder and npm install again, because if is overwritten with the aot hack, which his here:
https://github.com/patrikx3/corifeus-builder-angular/blob/master/src/config/webpack/angular/prod.js#L52

I know many other guys are having an issue with this, there are less stars , than how many they actually use it at https://gist.github.com/p3x-robot/e12ed76acb7033638b4179149546bb73

@filipesilva
Copy link
Contributor

I'm sorry but that is the big application that I mentioned in #12179 (comment). That's too big to be a simple reproduction of the problem and I don't have the time to debug your project.

If you make something simpler, like a simple webpack config with the minimum number of plugins/loaders, that builds a simple 1 component app, I can try and debug and see whats wrong. You can read here why this is needed.

@p3x-robot
Copy link
Author

this is not a problem at all, i use this hack by removing the decorators, so i just close it for you, take care

@p3x-robot
Copy link
Author

@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 12, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants