AOT error with ES6 target and not with ES5 (Angular 5)

150 views
Skip to first unread message

Arnaud Deman

unread,
Nov 23, 2017, 4:11:10 PM11/23/17
to Angular and AngularJS discussion
Hi,

I am facing this error when I use 'target':'ES6' in my tsconfig.json.
with ES5 it works.

There is no error during the compilation: ng serve -prod -aot

But this exception is thrown in the browser.

ERROR TypeError: Cannot read property '_moduleDoBootstrap' of undefined
    at e.donePromise.then (main.c9b31732f9a9986521f7.bundle.js:1)
    at e.invoke (polyfills.e6475d2787bb3154d59c.bundle.js:1)
    at Object.onInvoke (main.c9b31732f9a9986521f7.bundle.js:1)
    at e.invoke (polyfills.e6475d2787bb3154d59c.bundle.js:1)
    at r.run (polyfills.e6475d2787bb3154d59c.bundle.js:1)
    at polyfills.e6475d2787bb3154d59c.bundle.js:1
    at e.invokeTask (polyfills.e6475d2787bb3154d59c.bundle.js:1)
    at Object.onInvokeTask (main.c9b31732f9a9986521f7.bundle.js:1)
    at e.invokeTask (polyfills.e6475d2787bb3154d59c.bundle.js:1)
    at r.runTask (polyfills.e6475d2787bb3154d59c.bundle.js:1)

What could be be the right strategy to understand what happens in this kind of case ?
I have migrated my project under angular cli and Angular 5 from  Angular 4 at the same time. This  was not very smart,  there is a lot of changes and I am a little bit lost.

Thanks in advance,
regards,
Arnaud.

---
Output of ng version :
Angular CLI: 1.5.2
Node: 6.11.3
OS: linux x64
Angular: 5.0.2
... animations, common, compiler, compiler-cli, core, forms
... http, language-service, platform-browser
... platform-browser-dynamic, router

@angular/cli: 1.5.2
@angular-devkit/build-optimizer: 0.0.33
@angular-devkit/core: 0.0.20
@angular-devkit/schematics: 0.0.36
@ngtools/json-schema: 1.1.0
@ngtools/webpack: 1.8.2
@schematics/angular: 0.1.5
typescript: 2.4.2
webpack: 3.8.1




Sander Elias

unread,
Nov 23, 2017, 9:57:17 PM11/23/17
to Angular and AngularJS discussion
Hi Arnaud,

I use as target `es2015` which should be the same as 'es6' but you never know.. 
next thing I always do on large upgrades is `rm -fr node_modules yarn.lock` followed up by a `yarn`  (or npm if you use that, but don't forget to kill the lock file!

Regards
Sander

Arnaud Deman

unread,
Nov 24, 2017, 9:25:53 AM11/24/17
to Angular and AngularJS discussion
Hi Sander,

Thanks for your advice.

Unfortunatly I have the same error with es2015.
I will try to see if there is a way to narrow the problem, perhaps by disabling some step of aot if it is possible with angular cli.

I wonder if the source of the error could be in the DI as I use InjectionToken with interface. If it's the case, a solution could be to use a  class-interface instead of an interface ?


Thanks for your time,
regards,
Arnaud.
Reply all
Reply to author
Forward
0 new messages