-
Notifications
You must be signed in to change notification settings - Fork 303
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
Sugar throwing a runtime exception in Angular v6 application. #632
Comments
Thanks for this! I'll have a look into it too but for a workaround can you get in there and try to figure out which global it's trying to reference? |
I'll try to help out the best I can without being too familiar with the internals of the library. It looks like this error occurs during the mapping of the NATIVE_NAMES constant specifically when name === 'Object' forEachProperty(NATIVE_NAMES.split(' '), function(name) {
createNamespace(name);
}); // seems to be undefined
globalContext["Object"].prototype; |
When you log globalContext what do you get @phixMe? I recently was having this problem in firefox content scripts. It looks like globalContext defaults to |
I doubt that strict mode makes I fixed it by putting this workaround into polyfills.ts. window['global'] = window; |
That's one of the features of strict mode, though: https://coderwall.com/p/jes4dw/strict-mode-this-keyword-in-javascript |
We just ran into this issue as well. @tasuku-s does your workaround have any consequences in terms of AOT etc? |
@gaiottino I wonder why strict mode makes So maybe webpack or typescript wrap around with strict mode. |
Hi, sorry for the delay on this. I had a look into this issue. It seems that there are a couple of factors here. First it seems that @tasuku-s is right that there is a wrapper with strict mode going on that makes the assumed The fix here is I think for Sugar to stop making assumptions about the environment it's being run in and perform more robust checks for both the global context as well as |
Is 0cd73d1 intended to be the fix for this issue? |
I have used the following import syntax for the Sugar date module through Angular v5.2.10 and CLI v1.7.4 with success. Upon upgrading the version of Angular and its companions I observe the following issue reported by Sugar v2.0.4.
I have also tried the following without success...
I understand that this may be an Angular related issue, but I was curious if others have observed this upon upgrading their Angular applications.
The text was updated successfully, but these errors were encountered: