store: Unexpected value 'NgReduxModule' imported by the module 'AppEngine'

ngc error: Error: Unexpected value 'NgReduxModule' imported by the module 'AppEngine'

Did someone know how to solve it?

About this issue

  • Original URL
  • State: closed
  • Created 8 years ago
  • Comments: 54 (19 by maintainers)

Commits related to this issue

Most upvoted comments

I hope to get this fixed this week, just been travelling and haven’t had time to fully test things, but having ng2-redux work with AoT is high on my priority list.

My update on this:

I have a version working npm install ng2-redux@aot-beta that will have things working with AoT compiling and not complain about

Unexpected value ‘NgReduxModule’ imported by the module ‘AppEngine’

However, @select decorators do not work - and I’m trying to find a way to resolve this.

I was hoping to have both issues resolved in one release, as well - I’m big fan of @select

Another workaround is to do a prod build, but with AoT turned off

ng build --aot false -prod

If people are ok with @select not working and changing their code from

class MyClass {
 @select() stuff$;
}

// to

class MyClass {
    stuff$;

  ngOnInt() { 
   this.stuff=this.ngRedux.select('stuff');
  }
}

I can push out a non beta release of this soon.

I have an idea later tonight I want to try out to get @select working, but would possibly mean needing to inject ngRedux into your components/services even if you were not using it as everything else is being done from the decorators.

seems likely that it is due to the issue referenced by @duydao. NgRedux has a type parameter so you can strongly type your store; it would be a shame to sacrifice this. The increasing list of basic language constructs not supported by AoT is becoming tiresome.

Nonetheless we’ll see what we can do. @e-schultz let’s chat more about this when you’re back.

@danielcrk-cn @NeoLSN 4.0.0-beta.7 is now out, should fix that issue now - I had broken the generation of the metadata file which should be resolved now.

@NeoLSN can you try ng-redux@aot-beta? I’m not getting that issue in the toy app that I’m playing around with.

The issue seems to be that AoT just doesn’t like decorators that mutate the class. Even creating a simple decorator that adds a getter to return the string ‘this works’ - works without AoT, stops working with AoT - no error/bug/warning, just silently stops working.

The ‘list of things that AoT doesn’t support / throws errors on / silently has failing behavior with no error or warning’ has me questioning the readiness of AoT for production use (even outside of use with ng2-redux).

Later tonight I’ll push up my work in progress / example app.

Ideally I wanted to get a release out that would have both the module issue + decorators working in the same release, but what I may need to do is a release w/o decorators working with migration docs (pretty easy, but annoying - and really want to avoid pushing that onto the users), and then try and see if I can figure out a solution for the decorators.

@NeoLSN I run into the same error message, but it was caused by a dependency of redux itself (symbol-observable@1.0.3).

There seems to be a difference of the index.js file on git (https://github.com/blesh/symbol-observable/blob/master/es/index.js) and the npm package.

I’ve already created an issue for it: https://github.com/blesh/symbol-observable/issues/26

for now, you could replace the content of the index.js file in your node_modules with the one on git: (https://github.com/blesh/symbol-observable/blob/master/es/index.js)

Can you try ng2-redux@4.1.0? Should be fixed now. Sorry about that.

[23:48:57]  Error: Error encountered resolving symbol values statically. Function calls are not supported.
            Consider replacing the function or lambda with a reference to an exported function, resolving
            symbol AppModule in .../app.module.ts,
            resolving symbol AppModule in .../app.module.ts
[23:48:57]  ngc failed
[23:48:57]  ionic-app-script task: "build"
[23:48:57]  Error: Error

Did I do something wrong?

@e-schultz If there is a ng2-redux@aot-beta, I can do with this first. Thanks.

But it is still got error ngc: Error: Error at ... Generic type 'NgRedux<RootState>' requires 1 type argument(s).

i got solution to complete the app with ngc and no need to switch. well looking forward for the resolution as soon as possible.

Its due to missing metadata.json-files, see #223.