Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Not compatible with Ivy (experimental) #1647

Closed
paullessing opened this issue Jun 1, 2019 · 54 comments
Closed

Not compatible with Ivy (experimental) #1647

paullessing opened this issue Jun 1, 2019 · 54 comments

Comments

@paullessing
Copy link

paullessing commented Jun 1, 2019

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 angular/angular#28603 which states that if the package.json does not contain a types or typings property, the module will be excluded from compilation.

@ghost
Copy link

ghost commented Jun 1, 2019

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

@paullessing
Copy link
Author

paullessing commented Jun 2, 2019

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.

@ghost
Copy link

ghost commented Jun 2, 2019

ok, try

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

add AgmCoreModule.forRoot... to the imports

npm start

@paullessing
Copy link
Author

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

@ramses10
Copy link

ramses10 commented Jun 4, 2019

Same problem here.

@ghost
Copy link

ghost commented Jun 4, 2019

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

@ramses10
Copy link

ramses10 commented Jun 4, 2019

@doom777 fine for me

@drabadan
Copy link

drabadan commented Jun 5, 2019

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

@lakinducker
Copy link

lakinducker commented Jun 6, 2019

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.

@aviaur
Copy link

aviaur commented Jun 10, 2019

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

@BobBDE
Copy link

BobBDE commented Jun 14, 2019

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 : angular/angular-cli#14594 (comment)

And also this issue : angular/angular#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.

@ghost
Copy link

ghost commented Jun 14, 2019

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

@mruknowme
Copy link

Any updates on this issue?

@chakrachi
Copy link

same issue here when using latest angular beta and ivy

@ghost
Copy link

ghost commented Jul 26, 2019

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

@naveedahmed1
Copy link

Any update on this?

@ghost
Copy link

ghost commented Aug 8, 2019

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.

@naveedahmed1
Copy link

@terencehonles can you please update #1634 ?

@mruknowme
Copy link

Not published to npm?

@ghost
Copy link

ghost commented Aug 13, 2019

Not yet. We don't publish every commit.

@naveedahmed1
Copy link

naveedahmed1 commented Aug 13, 2019

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

@mruknowme
Copy link

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...

@pshurygin
Copy link

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.

@mruknowme
Copy link

mruknowme commented Sep 1, 2019

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

@mruknowme
Copy link

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?

@iget-master
Copy link

I'm in.

@ghost
Copy link

ghost commented Sep 1, 2019

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.

@iget-master
Copy link

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

@terencehonles
Copy link
Contributor

@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.

@ghost
Copy link

ghost commented Sep 16, 2019

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

@sebholstein
Copy link
Owner

sebholstein commented Sep 16, 2019 via email

@ephraim
Copy link

ephraim commented Sep 16, 2019

Hey @SebastianM,

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

Cheers,
Ephraim

@naveedahmed1
Copy link

@SebastianM are you referring to @doom777 comment #1647 (comment) ?

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 :)

@ghost
Copy link

ghost commented Sep 16, 2019

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

@ghost
Copy link

ghost commented Sep 16, 2019

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

@sebholstein
Copy link
Owner

sebholstein commented Sep 17, 2019 via email

@naveedahmed1
Copy link

@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 angular/angular#32506

Can you please take a look?

@JoostK
Copy link

JoostK commented Sep 26, 2019

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.

@naveedahmed1
Copy link

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

@JoostK
Copy link

JoostK commented Sep 27, 2019

So I was able to confirm that ngcc is unable to deal with the way decorators are being emitted since ng-packagr/ng-packagr#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?

@ghost
Copy link

ghost commented Sep 27, 2019

No, it was used with 5.4.3

Update: trying with 5.5.1 doesn't help either

@JoostK
Copy link

JoostK commented Sep 29, 2019

Here's a PR that deals with the way decorators are present in @agm/core 1.0.0: angular/angular#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.

@naveedahmed1
Copy link

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

@naveedahmed1
Copy link

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

@ghost
Copy link

ghost commented Nov 9, 2019

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

@ghost
Copy link

ghost commented Nov 12, 2019

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.

@ghost ghost closed this as completed Nov 12, 2019
@ahmadalibaloch
Copy link

"@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.

@refactorking
Copy link

refactorking commented May 27, 2020

"@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)
      ]
    };
  }
}

This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests