Angular-google-maps: Not compatible with Ivy (experimental)

Created on 1 Jun 2019  ·  54Comments  ·  Source: SebastianM/angular-google-maps

Issue description
When compiling with Ivy, the compilation fails with the following error:

ERROR in src/app/app.module.ts(8,12): error TS-991010: Value at position 1 in the NgModule.importss of AppModule is not a reference: [object Object]

Steps to reproduce and a minimal demo of the problem
I could not create a stackblitz or plunker for this as it is intending to show a compiler failure and I do not know how to demonstrate this.
You can check out https://github.com/paullessing/agm-ivy-demo and attempt to build after running yarn install.

  1. Install new project of Angular 8 using ng new
  2. Add @agm/core and set up the default import
    imports: [ BrowserModule, AgmCoreModule.forRoot({ apiKey: environment.mapsApiKey, }) ]
  3. Enable Ivy in tsconfig.app.json:
    { ... "angularCompilerOptions": { "enableIvy": true } }
  4. Enable AOT in angular.json to work around "lazy routes not found":
    { "projects": { "my-project": { "architect": { "build": { "options": { ... "aot": true, } } } } } }
  5. Run ng serve

Current behavior
Compile fails with error:

ERROR in src/app/app.module.ts(8,12): error TS-991010: Value at position 1 in the NgModule.importss of AppModule is not a reference: [object Object]

(Position 1 in the imports array is the AgmCoreModule.forRoot())

Expected/desired behavior
No compiler failures

angular2 & angular-google-maps version

"@agm/core": "1.0.0-beta.5",
Angular CLI: 8.0.1
Node: 10.16.0
OS: win32 x64
Angular: 8.0.0
... animations, common, compiler, compiler-cli, core, forms
... language-service, platform-browser, platform-browser-dynamic
... router

Package                           Version
-----------------------------------------------------------
@angular-devkit/architect         0.800.1
@angular-devkit/build-angular     0.800.1
@angular-devkit/build-optimizer   0.800.1
@angular-devkit/build-webpack     0.800.1
@angular-devkit/core              8.0.1
@angular-devkit/schematics        8.0.1
@angular/cli                      8.0.1
@ngtools/webpack                  8.0.1
@schematics/angular               8.0.1
@schematics/update                0.800.1
rxjs                              6.4.0
typescript                        3.4.5
webpack                           4.30.0

Other information
Compile works when Ivy is disabled.

May be related to https://github.com/angular/angular/issues/28603 which states that if the package.json does not contain a types or typings property, the module will be excluded from compilation.

important bug build system

Most helpful comment

I agree that this must be released ASAP. This library's incompatibility with ivy is one of few issues left preventing us from testing ivy on our mid-scale web app.

All 54 comments

Unable to reproduce. Could it be that importss has two 's'?

Unable to reproduce. Could it be that importss has two 's'?

I think that's because it's an array with name imports so the error message is attempting to pluralise it.

I just tried again with a brand new project, and it still fails (with beta version 6). I updated the details above.

ok, try

ng new my-proj --enable-ivy
cd my-proj
npm install @agm/core

add AgmCoreModule.forRoot... to the imports

npm start

That is literally exactly what I did in the demo project I linked in the description above.

Same problem here.

@paullessing @ramses10 would you like to join Discord so we can discuss this more interactively?

@doom777 fine for me

reproduced with build:prod
@doom777 have you tried with prod flag?

I am having the exact same problem. My app is similar to the example that Paul has shared. I get the Value at position 1 in the NgModule.importss of AppModule is not a reference: [object Object] on both ng b --prod and ng b.

Angular: 8.0.0
@agm/core: 1.0.0-beta.6

Hi, I have the same problem when Ivy is enabled :
ERROR in src/app/app.module.ts(37,12): error TS-991010: Value at position 16 in the NgModule.importss of AppModule is not a reference: [object Object]

Works when Ivy is disabled

By looking at the problem I found 2 related issue in angular and angular-cli package.

It seems that the error comes from a librairy that is outside of node_module and made available using path-mapping.

Check the following comment and issue : https://github.com/angular/angular-cli/issues/14594#issuecomment-497288501

And also this issue : https://github.com/angular/angular/issues/30945

Unfortunately I couldn't make the librairy works with the technique describe in the comment (first link) using : ./node_modules/.bin/ivy-ngcc -s ./dist.

I don't really understand what's going on, but maybe that can help you.

hmm, perhaps after implementing #1648 it would work. I am not aware of any path-linked libraries in our lib, but we do use unusual packing

Any updates on this issue?

same issue here when using latest angular beta and ivy

after testing, #1634 does fix it so the issue is with our obsolete build system. Hopefully @SebastianM can review and merge the PR

Any update on this?

Yes, I am trying to get the author of #1634 to update his PR so that we can merge it in. Hopefully next week. So far, I can't get a response, but if that continues, I'll clone his PR and do it myself.

@terencehonles can you please update https://github.com/SebastianM/angular-google-maps/pull/1634 ?

Not published to npm?

Not yet. We don't publish every commit.

Can you please publish this one, since it could be considered as major one as it offers support for Angular 9/IVY

Not yet. We don't publish every commit.

@doom777 it could be a good idea to publish since it is a major update and introduces major fix...

I agree that this must be released ASAP. This library's incompatibility with ivy is one of few issues left preventing us from testing ivy on our mid-scale web app.

@doom777 any updates in regards to when this or next version will be published? Is there any difficulties in publishing to npm? The package has 65k+ weely downloads that's how many people can benefit from new version.

From reading here https://docs.npmjs.com/creating-and-publishing-scoped-public-packages I understand that publidhing should be a quick and easy process, or am I missing something?:)

Thanks

@doom777 any updates?

Hey, everyone. I know some of you are anxious to have this fix released, but (1) I am not in charge of releasing new agm versions, (2) we released one fairly recently, and (3) Ivy is still in preview, so while it's important for us to release support, it's not PRIORITY 0 CRITICAL.
I messaged @SebastianM about releasing a new version, and am waiting for a response.

Thank you for the update and information.

Yes, Ivy is only in preview but still could help many developers already today.
Recent release shouldn't be a problem since npm allows to release every 24 hours ;)

Hope @SebastianM can consider new release soon :)

Thanks

@doom777 Not PRIORITY 0 CRITIAL, but very important.

Angular is about to release v9.0.0 that will enable ivy by default, and this package will be useless with this version. If the PR fixed it, I really can't see why don't release a new version.

Also, I see no reason to this package still being in beta. It work's just fine here, no bugs, no instability.

The PR I submitted (#1634) was to address AOT compilation which has been around for awhile (Angular 4+?), and this should be a good reason to release a new beta release.

Regarding #1647: Ivy requires happens to require AOT, which is why it would break on Ivy, but there might be other things about the library which needs to change to make it completely Ivy compatible.

At work I'm starting to experiment with building our application with Ivy, but there are other packages we depend on that seem to have issues, and upgrading to Ivy is not a core requirement of our application. As we have more time to test and we potentially add more mapping features I can look at contributing any changes I see necessary, but I can't make any commitments to how much time I have to help with this project.

@iget-master I would also not go as far as to say there are no bugs and no instability (not that I have encountered any, but there very well may be issues and keeping the "beta" tag does make it easier to iterate and change things that need to be changed before having a more stable API)

We get responses from contributors like it is not priority. I could argue that and say releasing this so it fixes AOT and Ivy support is somewhat significant. AOT has been for a while and in a couple of months time Angular 9 will be around with (expected) stable Ivy. Personally I see no reason to claim it is exactly 0 priority.

Secondly, what's the problem with just running a command and releasing it to npm?

It is claimed by a contributor that it may not be stable yet, fine, in which case keeping beta flag makes sense. BUT! Isn't beta suppose to be somewhat a volatile thing? Which means frequent releases are to be expected but what we see is barely one release a month. It might be a good idea to release current version as stable and the one fixing Ivy under beta flag if there are significant worries about its' instability.

And remember ~60k people weekly can potentially benefit from a new version ;)

Thanks

I am thinking of copying this repo exactly and releasing it to npm under a different name, so everybody who watches this thread can try it out until they catch up. Anybody else thinking of doing this?

I'm in.

We have nothing against you forking and deploying our lib, that's why it's open source. 😄
I am trying to get it out, but it's not as easy as 'running a command'. I expect beta.8 to be released way before Angular 9.

How can I help? Any feature needing test or development?

@mruknowme please don't do that.

@doom777 was starting to do just that before there was more traction on this repo. He's done a lot to help get the ball moving and I understand you're not happy with the pace, but it _has_ gotten better and forking only confuses people rather than having us all work together to try to make things faster.

Update: I am trying to get this released, unfortunately Sebastian is unreachable and only he can do npm deploys.

Hey,

saw this thread accidentally. @Ephraim where did you send me a messsage?
Maybe my push settings are messed up 😕 I can push a new version when I’m
home. Sorry for the delay!

Ephraim Khantsis notifications@github.com schrieb am Mo. 16. Sep. 2019 um
17:06:

Update: I am trying to get this released, unfortunately Sebastian is
unreachable and only he can do npm deploys.


You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
https://github.com/SebastianM/angular-google-maps/issues/1647?email_source=notifications&email_token=AACDGRABQG3CO4VBHKU3N23QJ6OHZA5CNFSM4HSA7KD2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOD6ZOZBA#issuecomment-531819652,
or mute the thread
https://github.com/notifications/unsubscribe-auth/AACDGRFLFLAZMJKKVQZUM7DQJ6OHZANCNFSM4HSA7KDQ
.

Hey @SebastianM,

sorry, can't remember that I send you a message!
Why should I've send you a message?

Cheers,
Ephraim

@SebastianM are you referring to @doom777 comment https://github.com/SebastianM/angular-google-maps/issues/1647#issuecomment-524882295 ?

BTW I also dropped you a message on twitter :D

We all understand that you are busy and appreciate you time and efforts to maintain this plugins :)

Hey! Glad you're around. I always try to reach you on twitter.

@SebastianM If you're already available, can you update the stackblitz template to use latest AGM version?

Yeah, sure

Am Mo., 16. Sept. 2019 um 20:20 Uhr schrieb Ephraim Khantsis <
[email protected]>:

@SebastianM https://github.com/SebastianM If you're already available,
can you update the stackblitz template to use latest AGM version?


You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
https://github.com/SebastianM/angular-google-maps/issues/1647?email_source=notifications&email_token=AACDGRDKLMG7VFW7CP6KVYDQJ7E5PA5CNFSM4HSA7KD2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOD62BQDQ#issuecomment-531896334,
or mute the thread
https://github.com/notifications/unsubscribe-auth/AACDGRA3WT7CYHW3JSZEMC3QJ7E5PANCNFSM4HSA7KDQ
.

@SebastianM @agm/core 1.0.0 was working fine with Angular 9.0.0-next.6 but with Angular 9.0.0-next.7 it started throwing this error again https://github.com/angular/angular/issues/32506

Can you please take a look?

Looked into this just now, @agm/core 1.0.0 has bundles which has decorators represented in a way that is strange to me. I'm looking into it.

Thanks @JoostK, looking forward for a fix soon :)

So I was able to confirm that ngcc is unable to deal with the way decorators are being emitted since https://github.com/ng-packagr/ng-packagr/pull/1401, released in ng-packagr 5.5.1.

This however is still surpising, as the yarn.lock file in this repo suggests that ng-packagr 5.4.3 is being used. @SebastianM could you confirm whether a newer release of ng-packagr was being used for publishing, without updating the yarn.lock file?

No, it was used with 5.4.3

Update: trying with 5.5.1 doesn't help either

Here's a PR that deals with the way decorators are present in @agm/core 1.0.0: https://github.com/angular/angular/pull/32901

@doom777 how do you know, were you the one that published the release? I don't quite understand how the 1.0.0 release of @agm/core could have both ctorParameters and __decorate calls if it was built with anything other than ng-packagr 5.5.1.

The plugin works perfectly with Angular 9.0.0-next.9 , thank you @JoostK for the awesome job :)

I finally switched to @angular/google-maps, working great so far :)

ok, good luck. Keep in mind, it has much fewer features

Just to add: We are having a very hard time being compatible with angular ivy in 8.0, but in 9.0 it works fine.

"@angular/core": "~9.1.0",
when I add forRoot to a feature module and call it in AppModule->Imports. This error occurs. Can't find any solution. I used Angular CLI Today to create the new App.

"@angular/core": "^9.1.6",
same...
"when I add forRoot to a feature module and call it in AppModule->Imports. This error occurs. Can't find any solution. I used Angular CLI Today to create the new App."

Finally found out the issue for my case.

... in module...

let registry = null;

export class UiUniversalCoreModule {
  public static forRoot(elements): ModuleWithProviders<UiUniversalCoreModule> {
    // Angular 9 required <UiUniversalCoreModule>
    registry = elements; // and had to change this code to work.
    return {
      ngModule: UiUniversalCoreModule,
      providers: [
        ComponentBuilderService
      ]
    };
  }
}

... Changed to ...

let registry = null;
function ngModuleIssue(elements){
  registry = elements;
  return ComponentBuilderService;
}

export class UiUniversalCoreModule {
  public static forRoot(elements): ModuleWithProviders<UiUniversalCoreModule> {
    return {
      ngModule: UiUniversalCoreModule,
      providers: [
        ngModuleIssue(element)
      ]
    };
  }
}
Was this page helpful?
0 / 5 - 0 ratings

Related issues

gizm0bill picture gizm0bill  ·  4Comments

gnujeremie picture gnujeremie  ·  3Comments

ChrisDevinePimss picture ChrisDevinePimss  ·  3Comments

Halynsky picture Halynsky  ·  3Comments

matishw picture matishw  ·  3Comments