btroncone / ngrx-store-logger

Advanced logging middleware for @ngrx/store applications

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Ahead-of-Time (AoT) compilation fails

ttmarek opened this issue · comments

Hi @btroncone,

First, thanks for all your hard work on this lib, it's great. But, recently I've been running into some issues with getting the AoT compiler to successfully compile the ngrx-store-logger. Here's the error I'm getting:

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 /path/to/app.module.ts, resolving symbol AppModule in /path/to/app.module.ts

We've set up an example that you can easily run to reproduce the problem here: https://github.com/rangle/angular-2-aot-sandbox

Just follow these steps:

git clone git@github.com:rangle/angular-2-aot-sandbox.git

cd angular2-aot-sandbox

npm install

node sandbox-loader.js ngrx-store-logger

You can find the example source here: https://github.com/rangle/angular-2-aot-sandbox/tree/master/tests/ngrx-store-logger

Any idea why this might be happening?

Hello @ttmarek,

Another dev ran into a similar issue with ngrx-localstorage. Essentially you need to avoid compose in the module setup in your production builds. Here is the issue: btroncone/ngrx-store-localstorage#13

Let me know if you have any other issues, hope this helps!

Closing as it appears this has been solved 👍

Hey sorry about that @btroncone, I completely forgot I opened this. The issue was with exporting the function expression. So we wrapped the meta reducer in another meta reducer that was defined and exported as a function declaration. Here's our documented solution: https://github.com/rangle/angular-2-aot-sandbox/tree/master/tests/ngrx-compose

Awesome, thanks! 👍🏻