angular-google-place icon indicating copy to clipboard operation
angular-google-place copied to clipboard

ERROR in RangeError: Maximum call stack size exceeded

Open aaBoustani opened this issue 6 years ago • 8 comments

I'm submitting a...


[ ] Regression (a behavior that used to work and stopped working in a new release)
[x] Bug report  
[ ] Feature request
[ ] Documentation issue or request

Current behavior

I import the module in app.modules and include it in imports. When I run ng serve --aot, I get an error ERROR in RangeError: Maximum call stack size exceeded.

Environment


Angular version: 5.1.3
Angular Google place version : 0.0.3
 
For Tooling issues:
- Node version: 9.2.1  
- Platform:  Linux Ubuntu-Gnome 17.04

aaBoustani avatar Jan 09 '18 17:01 aaBoustani

@psykolm22 Hey!

The reason for this is that your library is released with wrong metadata for AngularGooglePlaceDirective symbol:

"AngularGooglePlaceDirective": {
  "__symbolic": "reference",
  "name": "AngularGooglePlaceDirective"
},

The problem is connected with this issue https://github.com/angular/angular/issues/19219. (Seems it is not completely resolved)

In your library you're exporting AngularGooglePlaceDirective like:

export { AngularGooglePlaceDirective} from './directives/angular-google-place.directive';

https://github.com/psykolm22/angular-google-place/blob/master/src/lib/angular-google-place/index.ts#L14

and also importing the same directive from another path:

import { AngularGooglePlaceDirective } from './directives/index';

https://github.com/psykolm22/angular-google-place/blob/master/src/lib/angular-google-place/angular-google-place.module.ts#L2

I know it's hard to understand but Angular MetadataCollector just cuts metadata if it you have an identifier that refers to different paths. For me it looks like a bug

To workaround it just open angular-google-place/src/lib/angular-google-place/index.ts file and change export as follows:

export { AngularGooglePlaceDirective} from './directives/index';

After that you can open angular-google-place.metadata.json file and now metadata for your directive should look like(prettified version of course:)):

"AngularGooglePlaceDirective": {
      "__symbolic": "class",
      "decorators": [
        {
          "__symbolic": "call",
          "expression": {
            "__symbolic": "reference",
            "module": "@angular/core",
            "name": "Directive"
          },
          "arguments": [
            {
              "selector": "[angularGooglePlace]"
            }
          ]
        }
 ],

/cc @ocombe Can you please look at this?

Update: added minimal repro https://github.com/alexzuza/ng-metadata-bug

alexzuza avatar Jan 26 '18 19:01 alexzuza

@psykolm22 I created a PR for this issue with @alexzuza solution. Please have a look. Would be great if you could update the NPM repo, as it's blocking our production build. Thanks.

lujakob avatar Jan 29 '18 09:01 lujakob

In the meantime I have a built package in a public repository that can be used with the following package import "angular-google-place": "lujakob/angular-google-place-package",

lujakob avatar Jan 29 '18 10:01 lujakob

thank you so much @lujakob

ray-kay avatar Jan 30 '18 05:01 ray-kay

@lujakob Thanks for your public repo of angular-google-place! But i don't really get how to add it in my project! It would be awesome if you could give me more informations.

ouatrahim avatar Dec 11 '18 13:12 ouatrahim

@ouatrahim You add the package by adding the following line to your package.json "dependencies" part: "angular-google-place": "lujakob/angular-google-place-package" The usage is described in the readme of the original package https://github.com/psykolm22/angular-google-place

lujakob avatar Dec 11 '18 13:12 lujakob

@lujakob Thanks ! very helpfull!!!

ouatrahim avatar Dec 11 '18 18:12 ouatrahim

Is this really still not fixed? I updated all my packages yesterday in my frantic storm of googling and checking ALL of my files for potential recursive calls, imports, etc. until I FINALLY found this comment. I wasted so much time on this.

IRCraziestTaxi avatar Mar 14 '19 03:03 IRCraziestTaxi