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
Compiler-generated factory doesn't call 'new', which fails for ES6. #14816
[X ] bug report => search github for a similar issue or PR before submitting
[ ] feature request
[ ] support request => Please do not submit support request here, instead see https://github.com/angular/angular/blob/master/CONTRIBUTING.md#question
Current behavior
This line here calls '.callFn'. In a unit test, the DynamicTestModule module.ngfactory.js output will be jit_NgModuleInjector0.call(this, parent,[],[]);. This fails because NgModuleInjector is a class and needs to be called with 'new'.
Expected behavior
I believe '.instantiate' instead of '.callFn' needs to be called in some cases.
Minimal reproduction of the problem with instructions
See the plunk in #14808, however that issue currently blocks reproduction of this issue. If you modify the useFactory: () => ... to useFactory: function (... to bypass that issue, this issue should be the next one you hit. I tried to put up a gist for a modified compiler.js, but github doesn't seem to like the theta char used for the internal exports.
Yup, we were at 6 and dropped to 5 for ng4. I think if I recall JIT output es5 but worked fine with eS6, whereas AOT is outputing full es6 with class and super calls. It's not devastating, but we do miss a few things like generators.
Perhaps these two should be combined into one tracking JIT ES6 support, but duplicating now for completeness.
Activity
tbosch commentedon Mar 10, 2017
To be clear, this is the place where we call the super constructor...
tbosch commentedon Mar 10, 2017
Did this work in 2.x? As far as I know, our jit mode never worked with ES6 yet...
EricABC commentedon Mar 10, 2017
Yup, we were at 6 and dropped to 5 for ng4. I think if I recall JIT output es5 but worked fine with eS6, whereas AOT is outputing full es6 with class and super calls. It's not devastating, but we do miss a few things like generators.
Perhaps these two should be combined into one tracking JIT ES6 support, but duplicating now for completeness.
tbosch commentedon Mar 13, 2017
This is the same underlying problem / workaround as in #14808 (comment)
tbosch commentedon Mar 14, 2017
Closing this and tracking ES6 support in #15127.
angular-automatic-lock-bot commentedon Sep 11, 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.