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

Error encountered resolving symbol values statically #27

Closed
clozanosanchez opened this issue Dec 26, 2016 · 3 comments
Closed

Error encountered resolving symbol values statically #27

clozanosanchez opened this issue Dec 26, 2016 · 3 comments

Comments

@clozanosanchez
Copy link

I am using [email protected]. My purpose is to do AOT compilation with ngc, but I receive this error from ngc:

Error: Error encountered resolving symbol values statically. Calling function 'Ng2Webstorage', function calls are not supported. Consider replacing the function or lambda with a reference to an exported function, resolving symbol AppModule in /Users/carlos/Documents/Workspaces/Angular Workspace/myapp/src/app/app.module.ts.

The code of AppModule is:

import {NgModule} from '@angular/core';
import {BrowserModule} from '@angular/platform-browser';

import {Ng2Webstorage} from 'ng2-webstorage';

...

@NgModule({
    imports: [BrowserModule, Ng2Webstorage.forRoot({prefix: 'MYAPP', separator: '_'}), ...],
    declarations: [...],
    bootstrap: [...]
})
export class AppModule { }

I think your library is prepared for AOT and I am initialising correctly in my AppModule. Do you have any clue about what can be failing?

@PillowPillow
Copy link
Owner

PillowPillow commented Dec 26, 2016

Hi, the v1.4.3 should fix your issue. Please use the exposed fn configure instead of forRoot to define the prefix and the separator.

Example :

import {NgModule} from '@angular/core';
import {BrowserModule} from '@angular/platform-browser';
import {Ng2Webstorage, configure} from 'ng2-webstorage';

configure({ prefix: 'custom', separator: '.' });

// import {Ng2Webstorage, configure as WebstorageConfigure} from 'ng2-webstorage'; // Don't forget you can make an alias if the configure key is already in use
// WebstorageConfigure({ prefix: 'custom', separator: '.' });

@NgModule({
    declarations: [...],
    imports: [
        BrowserModule,
        Ng2Webstorage,
    ],
    bootstrap: [...]
})
export class AppModule {
}

@clozanosanchez
Copy link
Author

Thank you very much. I did the alias using 'as' instead of colon because it was failing:
import {Ng2Webstorage, configure as WebstorageConfigure} from 'ng2-webstorage';

@PillowPillow
Copy link
Owner

edited, thank you.

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

No branches or pull requests

2 participants