Unleash/unleash-proxy-client-js

Angular compiler warns about CommonJS or AMD

snowfrogdev opened this issue · 5 comments

When trying to build an Angular app that depends on unleash-proxy-client, it warns that "CommonJS or AMD dependencies can cause optimization bailouts. For more info see: https://angular.io/guide/build#configuring-commonjs-dependencies"

Is it possible to make an ES Module build?

stale commented

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

Hey, @snowfrogdev! I'm sorry, but it seems we missed this issue when you opened it 🙇🏼 Is this still an issue? I remember you gave us some very nice contributions around that time, so I'm not sure whether this is resolved or not.

@thomasheartman this is still an issue, any update on a possible solution/workaround?

For me specifically, it throws this error:

Warning: undefined depends on 'unleash-proxy-client'. CommonJS or AMD dependencies can cause optimization bailouts. For more info see: https://angular.io/guide/build#configuring-commonjs-dependencies

Hey, @timothylombrana! Thanks for reporting in 😄

Is it actually stopping the build in any way?

If I understand correctly, it's just a warning saying that it's unable to do optimizations when bundling (tree-shaking, I suppose), and it shouldn't cause any build errors. If it's preventing you from building, then you might need to allow the build to proceed with warnings. This SDK has a fairly small amount of dependencies, so it shouldn't be that big a deal, I think.

That said, I don't we've done anything to address this since then. I'll ask around if anyone on the team knows anything more, though. We don't get a lot of input from Angular users, so we see this asked about very infrequently.

@thomasheartman it is not stopping the build in any way. I did add all the dependencies([tiny-emitter,uuid]) to the angular.json under allowedCommonJsDependencies as suggested by NG. But it doesn't resolve the warning. I wanted to share my finding, hoping we could fix the warning.