Skip to content

Error importing WpApiModule / and AOT #19

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

Closed
klihelp opened this issue Dec 24, 2016 · 18 comments
Closed

Error importing WpApiModule / and AOT #19

klihelp opened this issue Dec 24, 2016 · 18 comments

Comments

@klihelp
Copy link

klihelp commented Dec 24, 2016

import { WpApiModule } from 'wp-api-angular';

ERROR in Error encountered resolving symbol values statically. Calling function 'WpApiModule', function calls are not supported. Consider replacing the function or lambda with a reference to an exported function, resolving symbol AppModule in /Users/mac/../src/app/app.module.ts

ref: angular/angular-cli#3707

@klihelp
Copy link
Author

klihelp commented Dec 25, 2016

Manual editing fix in wp-api-angular.d.ts:

ps - from npm install wp-api-angular the project looks older than at develop branch ..

export declare class WpApiModule {
    // static initializeApp(config: WpApiAppConfig): ModuleWithProviders;
    static initializeApp(config: WpApiAppConfig): ModuleWithProviders {
    	return {
			ngModule: WpApiModule,
			providers: [
			]
		}
	}
}

@klihelp klihelp closed this as completed Dec 25, 2016
@klihelp
Copy link
Author

klihelp commented Jan 21, 2017

The above changes works with angular JIT compilation, but not with AOT.

[at-loader] Checking finished with 1 errors
[at-loader] node_modules/wp-api-angular/wp-api-angular.d.ts:22:71 
    An implementation cannot be declared in ambient contexts. 

@klihelp klihelp reopened this Jan 21, 2017
@shprink
Copy link
Collaborator

shprink commented Jan 21, 2017

checking, thanks for reporting

@shprink
Copy link
Collaborator

shprink commented Jan 22, 2017

I released beta3, it should fix the AoT. Upgrade, try and let me know :)

@klihelp
Copy link
Author

klihelp commented Jan 22, 2017

Still the same error:

Starting compilation using the angular compiler.
Angular compilation done, starting webpack bundling.
Error: Error encountered resolving symbol values statically.
Calling function 'WpApiModule', function calls are not supported.
Consider replacing the function or lambda with a reference 
to an exported function, resolving symbol AppModule in ..

@shprink
Copy link
Collaborator

shprink commented Jan 23, 2017

Are you sure you have beta3?

I can now run the following command:

$ ng build --aot
Hash: 6a207f80a1a31c8def16
Time: 11483ms
chunk    {0} main.bundle.js, main.bundle.map (main) 61.6 kB {2} [initial] [rendered]
chunk    {1} styles.bundle.css, styles.bundle.map, styles.bundle.map (styles) 1.77 kB {3} [initial] [rendered]
chunk    {2} vendor.bundle.js, vendor.bundle.map (vendor) 2.02 MB [initial] [rendered]
chunk    {3} inline.bundle.js, inline.bundle.map (inline) 0 bytes [entry] [rendered]

before beta3 I had:

ERROR in Error encountered resolving symbol values statically. Calling function 'WpApiModule', function calls are not supported. Consider replacing the function or lambda with a reference to an exported function, resolving symbol AppModule in /Users/julienrenaux/Sites/wp-api-angularjs/aot/src/app/app.module.ts, resolving symbol AppModule in /Users/julienrenaux/Sites/wp-api-angularjs/aot/src/app/app.module.ts

@klihelp
Copy link
Author

klihelp commented Jan 24, 2017

yes, I have manually checked package.json.

I use with this webpack based starter project:
https://github.com/Websitescity/ng2-f6-starter

@shprink
Copy link
Collaborator

shprink commented Jan 25, 2017

ok thanks for sharing, I am going to try on this too!

@shprink
Copy link
Collaborator

shprink commented Jan 27, 2017

I can reproduce, this will help me fixing it thanks!

@shprink
Copy link
Collaborator

shprink commented Jan 27, 2017

should be fine with beta4. please try and let me know

@shprink
Copy link
Collaborator

shprink commented Jan 30, 2017

@klihelp can we close?

@klihelp
Copy link
Author

klihelp commented Jan 31, 2017

I am getting an error on 3.0.0-beta4, issue #20

@shprink
Copy link
Collaborator

shprink commented Jan 31, 2017

beta5 now works with Angular CLI but not on you startup project and Ionic CLI. On it..

@shprink
Copy link
Collaborator

shprink commented Jan 31, 2017

well actually it works on your project too. please confirm

@shprink
Copy link
Collaborator

shprink commented Feb 1, 2017

beta6 works on all cases. please try

@klihelp
Copy link
Author

klihelp commented Feb 1, 2017

Thanks for your project. All works now.

@klihelp klihelp closed this as completed Feb 1, 2017
@shprink
Copy link
Collaborator

shprink commented Feb 1, 2017

Finally!

@klihelp klihelp changed the title Error importing WpApiModule Error importing WpApiModule / and AOT Mar 16, 2017
@klihelp
Copy link
Author

klihelp commented Mar 16, 2017

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