-
Notifications
You must be signed in to change notification settings - Fork 3k
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
[bug] global is not defined #1166
Comments
Also facing this issue currently |
Since angular/angular-cli#8160 is now resolved, can we close this issue? Thanks! |
I don't think so, because in the angular/cli > 6 they permanently removed global. BR, |
A workaround until Angular CLI maybe fixes it or make it possible to override the node command, then you can add the socket.io-client slim file in the paths section of the
|
Even if it does currently work, according to angular/angular-cli#9827 (comment), this will be an issue in "[this] just generally make for a situation where browser code that shouldn't work at all works only when built in with very specific tooling. This is not a good situation. " |
I confirm it's broken in Angular 6 RC5. Does anybody know a workaround? |
@ngervasi we have done it by doing like i commented here: #1166 (comment) |
I tried:
but it's not working in Angular 6RC5, I still get the error:
|
According to angular/angular-cli#8160 (comment): adding the following // Add global to window, assigning the value of window itself.
(window as any).global = window; In any case, this issue should not be resolved IMO, socket.io-client should either remove the implicit dependency on (BTW where are the sources for latest |
Which is the better fix? #1166 (comment) (adding to paths in tsconfig) or #1166 (comment) (assigning to global)? Both options worked for me in Angular v6 project generated with Angular CLI. |
@amitport the sources for the Though I'm afraid it's not the sole occurence. |
@darrenmothersele don't think there is exactly one "better". Adding 'global' may have side effects for other libs while adding the 'slim' file may have a negative effect on bundle size (not necessarily) @darrachequesne added a PR darrachequesne/has-binary#4 (it's a start :)) |
I tried both solutions and with a current angular 6.0.0 project and none works. I added the paths entry to the tsconfig.app.json and the entry to polyfills.ts but still getting the same error in chrome. |
same here, the tsconfig solution does not work on ng cli 6 |
// Add global to window, assigning the value of window itself. is working for me |
Works for me, too! Thanks! |
It works for me too ! Thanks a lot ! :D |
where did you put |
Hello,
Just right there (on the picture).
2018-05-17 21:07 GMT+02:00 Alberto Basaglia <notifications@github.com>:
… where did you put (window as any).global = window; ?
Thanks.
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
<#1166 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/APZTlGpMwMpnAscifHT2ZQrRUSJqLejCks5tzcp3gaJpZM4QD_kq>
.
--
*Arnaud Tussy-Vassilieff*
*Développeur web full-stack chez Leaf Websites*
*Site web : www.leaf-website.esy.es <http://www.leaf-website.esy.es>*
*Mail : a.tussy.vassilieff@gmail.com <a.tussy.vassilieff@gmail.com>*
*Tél : 07 77 83 29 44*
|
Put this in your
|
between line 63 and 70
2018-05-31 18:31 GMT+02:00 Bibhas Bhattacharya <notifications@github.com>:
… where did you put...
Put this in your polyfills.ts
(window as any).global = window
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
<#1166 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/APZTlPci9GKE3R8lwc1g3qfqWODeXIPiks5t4Br1gaJpZM4QD_kq>
.
--
*Arnaud Tussy-Vassilieff*
*Développeur web full-stack chez Leaf Websites*
*Site web : www.leaf-website.esy.es <http://www.leaf-website.esy.es>*
*Mail : a.tussy.vassilieff@gmail.com <a.tussy.vassilieff@gmail.com>*
*Tél : 07 77 83 29 44*
|
@amitport thanks the workaround you provided works!! @angularteam, How come you keep breaking everything guys :/ you even managed to get your people in the rxjs team and suddenly even rxjs breaks everything now on version changes... been keeping up with angular since first stable release and Im amazed at your ability to break everything on each release. |
@LucasFrecia it's a socket.io issue not Angular's. Angular did good by stopping to hide it in version 6 (which is marked as a major breaking release) Added another pull request two weeks ago webmodules/blob#14 for https://github.com/webmodules/blob (used by engine.io-parser). It isn't getting any response, anyone here can merge it? @darrachequesne @rauchg @nkzawa? |
Adding the (window as any).global = window; to the polyfills.ts worked for me |
the polyfills.ts solution works for me |
@amitport So which version of socket.io-client could fix this problem? It seems that it does not work even after upgrading to version 2.3.0. socket.io-client@2.3.0 still depends on engine.io-client@3.4.4, which references 'global', so it's getting the same error. |
I closed this issue as it started to diverge to many different issues related to global usage. This started as a specific use case and was not about removing 'global' in general. I suggest checking if your issue exists elsewhere and opening a new one if needed. |
I found it was actually an issue with vite and yarn pnp, instead of a sheer socket.io-client problem. |
Note: for support questions, please use one of these channels: stackoverflow or slack
You want to:
Current behaviour
socket.io-client doesn't work with @angular/cli@1.5.0-rc.3 because of a dependency on node.js'
global
var(seems to come from
has-binary2@1.0.2
, but I can't find who maintains that versions)Steps to reproduce (if the current behaviour is a bug)
see angular/angular-cli#8160
Expected behaviour
Setup
2.0.4
The text was updated successfully, but these errors were encountered: