question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Angular 4.rc6 and 1.0.0-alpha.21 fails when AOT building

See original GitHub issue

Bug description:

https://github.com/leon/bug-ng-bootstrap-aot-build

Developing works

yarn start
$ ng serve 
** NG Live Development Server is running on http://localhost:4200 **
Hash: 888ec32125e57675671c                                                              
Time: 8119ms
chunk    {0} polyfills.bundle.js, polyfills.bundle.js.map (polyfills) 158 kB {4} [initial] [rendered]
chunk    {1} main.bundle.js, main.bundle.js.map (main) 3.82 kB {3} [initial] [rendered]
chunk    {2} styles.bundle.js, styles.bundle.js.map (styles) 9.77 kB {4} [initial] [rendered]
chunk    {3} vendor.bundle.js, vendor.bundle.js.map (vendor) 2.57 MB [initial] [rendered]
chunk    {4} inline.bundle.js, inline.bundle.js.map (inline) 0 bytes [entry] [rendered]
webpack: Compiled successfully.

Build with AOT fails

yarn build
$ ng build --aot 
 10% building modules 3/3 modules 0 activeCould not resolve module 'function toString() { [native code] }' relative to file /Users/leon/Temp/bug-aot-build/node_modules/@ng-bootstrap/ng-bootstrap/util/util.d.ts
Hash: ffa896c7e882276dae4e                                                              
Time: 2665ms
chunk    {0} polyfills.bundle.js, polyfills.bundle.js.map (polyfills) 158 kB {4} [initial] [rendered]
chunk    {1} styles.bundle.js, styles.bundle.js.map (styles) 9.77 kB {4} [initial] [rendered]
chunk    {2} main.bundle.js, main.bundle.js.map (main) 1.09 kB {3} [initial] [rendered]
chunk    {3} vendor.bundle.js, vendor.bundle.js.map (vendor) 805 kB [initial] [rendered]
chunk    {4} inline.bundle.js, inline.bundle.js.map (inline) 0 bytes [entry] [rendered]

ERROR in m.replace is not a function

ERROR in ./src/main.ts
Module not found: Error: Can't resolve './$$_gendir/app/app.module.ngfactory' in '/Users/leon/Temp/bug-aot-build/src'
 @ ./src/main.ts 4:0-74
 @ multi ./src/main.ts
error Command failed with exit code 1.

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:5 (4 by maintainers)

github_iconTop GitHub Comments

10reactions
pkozlowski-opensourcecommented, Mar 23, 2017

OK, I can confirm now that this is a regression in Angular, see the details in https://github.com/angular/angular/issues/15420.

Depending on the team’s feedback it will be either fixed today or I will work-around it here by renaming the offending util function. In any case I’m planning to cut a 4.0.0 compatible release today or tomorrow morning the latest.

1reaction
pkozlowski-opensourcecommented, Mar 23, 2017

I can confirm this one. This is definitively a regression in rc.6 or "@ngtools/webpack": "1.2.14" as the same code works perfectly fine with rc.5 / “@ngtools/webpack”: “1.2.13”.

The root cause / error is:

10% building modules 3/3 modules 0 activeModuleNotFoundError: Module not found: Error: Can’t resolve ‘./…/…/$$_gendir/demo/src/app/app.module.ngfactory’ in ‘/Users/pawelkozlowski/work/gitrepos/pkozlowski-opensource/core/demo/src’

I’m going to narrow it down and check with the rest of the Angular team to track it down / fix. At the moment it looks like an issue in the Angular. Thx for reporting.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Cannot read property 'replace' of undefined when running ...
angular -cli: 1.0.0-beta.20-4 ... src/app/app.module.ngfactory.ts Module build failed: TypeError: Cannot ... Without --aot it works fine.
Read more >
Angular 5 AOT compilation failed - typescript - Stack Overflow
The question is why my app only works properly when I don't use AOT feature? Why is this so strange? What should I...
Read more >
module not found: error: can't resolve '@angular/localize/init'
I get an exception throw Module not found: Error: Cant resolve @angular/localize/init in Angular 11 when I trying to build project with ng...
Read more >
angular/angular - Gitter
Hey guys, I'm building library which I'm going to distribute. It has quite complex UX, so that's why I want to use Angular...
Read more >
angular-confirmation-popover documentation
Bug Fixes. fix popover arrow positioning for bootstrap 4 (144e34a) ... 3.4.1 (2017-11-21) ... aot: fix aot compiling with angular4 (b81a45d), closes #63 ......
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found