in 1.0.0-beta.24 getting ERROR in Error encountered resolving symbol values statically
OS?
Windows 10 64
Versions.
latest ng 2.4.1 and cli 1.0.0-beta.24
Repro steps.
Angular 2 Kitchen sink: http://ng2.javascriptninja.io and source@ https://github.com/born2net/Angular-kitchen-sink
ERROR in Error encountered resolving symbol values statically. Calling function 'MsLibModule', function calls are not supported. Consider replacing the function or lambda with a reference to an exported function, resolving symbol AppModule in C:/msweb/Angular-kitchen-sink/src/app/app.module.ts, resolving symbol AppModule in C:/msweb/Angular-kitchen-sink/src/app/app.module.ts
webpack: bundle is now VALID.
I am loading a module with forRoot as in:
imports: [
...
MsLibModule.forRoot(),
...
],
which doens't do much,
export class MsLibModule {
static forRoot(): ModuleWithProviders {
return {
ngModule: MsLibModule,
providers: []
};
}
}
as you can see no lambada needed... and still getting the error of:
ERROR in Error encountered resolving symbol values statically. Calling function 'MsLibModule', function calls are not supported. Consider replacing the function or lambda with a reference to an exported function, resolving symbol AppModule in C:/msweb/Angular-kitchen-sink/src/app/app.module.ts, resolving symbol AppModule in C:/msweb/Angular-kitchen-sink/src/app/app.module.ts
regards
Sean
Have the same problem.
Reverting to 1.0.0-beta.19-3 like @alvachien mentioned fixes the issue for me. I also experimented with working backwards through versions and the first version that did not break ng build for me is 1.0.0-beta.21.
I'm putting this back out there: "just to add my error into the mix:
ERROR in Error encountered resolving symbol values statically. Could not resolve events relative to /Users/.../node_modules/@types/mongodb/index.d.ts., resolving symbol Db in Users/.../node_modules/@types/mongodb/index.d.ts
Why is it going into mongodb when nothing in my client side code refs that module?"
Devs, any help here?
@photostu without any project or code to look at there's nothing we can do.
Actually I have an idea, try to add "files": ["main.ts"] to your tsconfig.json, tell us if that works.
@hansl you can see mine example from above. Just extend the EventEmitter.
I will work on a sample to reproduce
I think I'm sorted now... I had @types/mongodb in my package.json dependencies. Moving that to devDeps seems to have solved it!
in my package.json there is no @types/mongodb. what should i do
well, my backend project needs that @types/mongodb package in dependencies, so I may have to consider splitting out the project :(
Ha, I just added a build task to rename the offending mongo index.d.ts during the client build step then revert it for server build!
@paruvellyvishwanath what is your error? You may have another offender package
when i run npm run build:prod i am getting below error
Error encountered resolving symbol values statically. Could not reso
lve events relative to C:/Users/evontex/Desktop/01 Seed_1/node_modules/@typ
es/mongodb/index.d.ts., resolving symbol Db in C:/Users/evontex/Desktop/01
Seed_1/node_modules/@types/mongodb/index.d.ts
@photostu can you post your hack?
It's really simple, just add 2 build steps to rename the offending file before the client build, then fix it back before your server build. Total hack job.
came back to confirm. hackasarus rex will have to do until the actual bug gets fixed
@photostu Rename to what? If i rename file, i get 'cannot find type definition file for mongodb'.
@vladimirdjurdjevic you have to perform 2 renames in this process. First rename it with a diff extension so the client build doesn't recognize it as a .ts Then, after your client build is finished and you need to perform your server build, you rename it back to its original filename. Hope this makes sense.
@angular/cli 1.0.0-rc.0 still has same problem. 3 months passed and still we can't use newest AOT to compile our projects that use forRoot static method to provide providers for root module. :(
any progress about this issue, we have the same problem.