Related to ERROR in Error encountered resolving symbol values statically
Further reference: 1 2 3 4 5
I am currently building a TypeScript library for Angular (using Angular 4). After enabling AOT, I am getting this error.
ERROR in Error encountered resolving symbol values statically. Calling function 'ɵmakeDecorator', function calls are not supported. Consider replacing the function or lambda with a reference to an exported function, resolving symbol NgModule in /home/.../node_modules/@angular/core/core.d.ts, resolving symbol MyModule in /home/.../dist/contents.module.d.ts, resolving symbol MyModule in /home/.../dist/contents.module.d.ts
Depending on the Angular version I get this other error instead:
ERROR in Error encountered resolving symbol values statically. Calling function 'makeDecorator', function calls are not supported[...]
Enabling AOT on the Angular project prevented this:
ERROR in MyModule is not an NgModule
Force your Angular project (or angular-cli) to load your @angular
dependencies from your main project, not the library's one.
tsconfig.json (remember that angular-cli main tsconfig files remain in src/tsconfig.app.json and tsconfig.spec.json)
"compilerOptions": {
...
"paths": { "@angular/*": ["../node_modules/@angular/*"] }
}
Credits to SebastianSchenk and drew-moore.
After a few hours testing and digging through GitHub issue responses...
I found out it was as simple as not having a node_modules/
folder inside the client's installation. That is the library I was working on (click here to go up until the commit it was working OK).
Hence, you might have node_modules
whilst working in your development setup, but as soon as you integrate your project into another one remove that folder.
In my case, the reason we I was having a node_modules folder inside the client's folder was due to a previous npm link
-> npm link my-package
. Since I was working with node_modules
on my development setup they were on the linked folder as well.
Note that your issue might as well come from somewhere else:
For example: beware of lambdas, use function instead.
and a lot more:
make sure to check the full description of each of these — credits to Isaac Mann.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With