1
votes

I am working on an Angular 4 project that utilizes angular-cli. It is finally almost done -- and yet another stumbling block.

If I run ng build the project builds fine.

If I run ng build --prod the following error is thrown:

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 Injectable in C:/SRC/Sandbox/eat-sleep-code.com/node_modules/ng2-gist/node_modules/@angular/core/src/di/metadata.d.ts, resolving symbol OpaqueToken in C:/SRC/Sandbox/eat-sleep-code.com/node_modules/ng2-gist/node_modules/@angular/core/src/di/opaque_token.d.ts, resolving symbol OpaqueToken in C:/SRC/Sandbox/eat-sleep-code.com/node_modules/ng2-gist/node_modules/@angular/core/src/di/opaque_token.d.ts

ERROR in ./src/main.ts Module not found: Error: Can't resolve './$$_gendir/app/app.module.ngfactory' in 'C:\SRC\Sandbox\eat-sleep-code.com\src' @ ./src/main.ts 4:0-74 @ multi ./src/main.ts

How do I get around this?

1
From the error it seems like you wrote some makeDecorator function that is throwing errorsMike Tung
I didn't. Perhaps a plugin is. I see it is mentioning the ng2-gist plugin. However, why does it build correctly without the prod flag?eat-sleep-code
Prod flag I am assuming has some stricter criteria like check that nothing is being unused or not being drawn from a local library that's my guessMike Tung
angular library should not contain node_modules folder with angular modules. Just copy ng2Gist component in your project github.com/jasonhodges/ng2-gist/blob/master/src/…yurzui
You're getting error that is related with _getResourcesUrls function inside @ngtool/webpack Looks like you have wrong path somewhereyurzui

1 Answers

1
votes

Angular library should not contain node_modules. It will raise unpredictable errors.

I would advice you to create your own copy ng2Gist directive in your project because it is very simple directive