You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
AOT Compiler not working with Route data property #18886
[ ] Regression (a behavior that used to work and stopped working in a new release)
[x] Bug report
[ ] Feature request
[ ] Documentation issue or request
[ ] Support request => Please do not submit support request here, instead see https://github.com/angular/angular/blob/master/CONTRIBUTING.md#question
Current behavior
AOT compiler not resolving Object access in routes data property
Expected behavior
The AOT retrieves the property value from the accessed Object
Minimal reproduction of the problem with instructions
I even tried to use the Roles object appended to the window object but the AOT resolves it instead of keeping the window object as it keeps in other parts of the project.
The angular template compiler now treats this case specially and rewrites the .js to introduce a shrouded export for the value of data and then generates a reference to this shrouded export.
Edit: I just gave a try with angular5 & ng-cli 1.5, and it does NOT work.
If I enable AOT, no error, but the function configuration is ignored (probably dropped during AOT compilation):
ng serve --aot
And if I don't:
ng serve
I get this message:
webpack-internal:///../../../../../src/app/app.errors.ts:12 Error: Uncaught (in promise): Error: function configuration is not supported in aot mode
Error: function configuration is not supported in aot mode
at ApiResolver.resolve (webpack-internal:///../../../../../src/app/backend/resolvers/api.resolver.ts:53)
at PreActivation.getResolver (webpack-internal:///../../../router/esm5/router.js:3979)
at PreActivation.resolveNode (webpack-internal:///../../../router/esm5/router.js:3953)
at PreActivation.runResolve (webpack-internal:///../../../router/esm5/router.js:3929)
at MergeMapSubscriber.eval [as project] (webpack-internal:///../../../router/esm5/router.js:3570)
at MergeMapSubscriber._tryNext (webpack-internal:///../../../../rxjs/_esm5/operators/mergeMap.js:133)
at MergeMapSubscriber._next (webpack-internal:///../../../../rxjs/_esm5/operators/mergeMap.js:123)
at MergeMapSubscriber.Subscriber.next (webpack-internal:///../../../../rxjs/_esm5/Subscriber.js:96)
at ArrayObservable._subscribe (webpack-internal:///../../../../rxjs/_esm5/observable/ArrayObservable.js:121)
at ArrayObservable.Observable._trySubscribe (webpack-internal:///../../../../rxjs/_esm5/Observable.js:177)
at ApiResolver.resolve (webpack-internal:///../../../../../src/app/backend/resolvers/api.resolver.ts:53)
at PreActivation.getResolver (webpack-internal:///../../../router/esm5/router.js:3979)
at PreActivation.resolveNode (webpack-internal:///../../../router/esm5/router.js:3953)
at PreActivation.runResolve (webpack-internal:///../../../router/esm5/router.js:3929)
at MergeMapSubscriber.eval [as project] (webpack-internal:///../../../router/esm5/router.js:3570)
at MergeMapSubscriber._tryNext (webpack-internal:///../../../../rxjs/_esm5/operators/mergeMap.js:133)
at MergeMapSubscriber._next (webpack-internal:///../../../../rxjs/_esm5/operators/mergeMap.js:123)
at MergeMapSubscriber.Subscriber.next (webpack-internal:///../../../../rxjs/_esm5/Subscriber.js:96)
at ArrayObservable._subscribe (webpack-internal:///../../../../rxjs/_esm5/observable/ArrayObservable.js:121)
at ArrayObservable.Observable._trySubscribe (webpack-internal:///../../../../rxjs/_esm5/Observable.js:177)
at resolvePromise (webpack-internal:///../../../../zone.js/dist/zone.js:824)
at resolvePromise (webpack-internal:///../../../../zone.js/dist/zone.js:795)
at eval (webpack-internal:///../../../../zone.js/dist/zone.js:873)
at ZoneDelegate.invokeTask (webpack-internal:///../../../../zone.js/dist/zone.js:425)
at Object.onInvokeTask (webpack-internal:///../../../core/esm5/core.js:4815)
at ZoneDelegate.invokeTask (webpack-internal:///../../../../zone.js/dist/zone.js:424)
at Zone.runTask (webpack-internal:///../../../../zone.js/dist/zone.js:192)
at drainMicroTaskQueue (webpack-internal:///../../../../zone.js/dist/zone.js:602)
at <anonymous>
@chuckjaz you are right. For non-aot, it was a test in the application code to avoid the application to break only after deploying with AOT mode enabled.
Activity
sougiovn commentedon Aug 26, 2017
I even tried to use the
Rolesobject appended to thewindowobject but the AOT resolves it instead of keeping thewindowobject as it keeps in other parts of the project.Instead of having
I'm having
Toub commentedon Sep 1, 2017
I have a similar problem while trying to use the following router data configuration:
After aot compilation, the function 'company' is missing in data.ApiResolver object.
chuckjaz commentedon Oct 27, 2017
Can you test this again in
5.0.The angular template compiler now treats this case specially and rewrites the
.jsto introduce a shrouded export for the value ofdataand then generates a reference to this shrouded export.sougiovn commentedon Oct 28, 2017
@chuckjaz I was just looking for the
5.0version releaseToub commentedon Nov 10, 2017
Edit: I just gave a try with angular5 & ng-cli 1.5, and it does NOT work.
If I enable AOT, no error, but the function configuration is ignored (probably dropped during AOT compilation):
And if I don't:
I get this message:
chuckjaz commentedon Nov 10, 2017
@Toub
app/backend/resolvers/api.resolver.ts:53seems to be application code.If this is caused indirectly by the compiler can you link a github repository that contains a repro of the issue?
Toub commentedon Nov 13, 2017
@chuckjaz you are right. For non-aot, it was a test in the application code to avoid the application to break only after deploying with AOT mode enabled.
chuckjaz commentedon Nov 13, 2017
As the underlying issue is fixed, I am closing this bug.
sougiovn commentedon Nov 21, 2017
@chuckjaz It's OK, everything working now. Sorry for the delay.
angular-automatic-lock-bot commentedon Sep 12, 2019
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.