-
Notifications
You must be signed in to change notification settings - Fork 369
webpack browser build broken due to usage of "global" #493
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
Comments
Hi @vecernik, sorry for my slow response. Are you still having this problem with version 1.2.4? The way our own webpack build is set up, it includes a module called If you're not getting this file in your build, it's probably due to how you have webpack configured. |
If you're having issues with how webpack compiles Faye from source, you can also use the pre-bundled minified file from the |
with faye-1.2.4, I still need self['global'] = self manual polyfill for a browser in Typescript (angular8) project for a use in import { Client } from 'faye'. |
If you run the following command in the Faye repo, do you see the
|
I have a similar issue with production build. In my case I use it in Vue application. The development build is working correctly, but the production build is not getting any messages. The console prints that subscribe was ok but messages never arrive. Same code in development (using the same faye node server) works ok. |
In order to make progress with this I need someone to find out whether webpack is including |
I'll be happy to assist, just tell me what/how to do. |
@mirono Sorry for my delayed response. If you're still having a problem with this, clone this repo and run:
The output should include this line:
If the issue is resolve, please close it :) |
This is also an issue in Vite (at least in dev mode - esbuild). Haven't checked what it builds out like in production mode. Without Webpack helping (I'm trying to transition from Webpack to Vite as I write this), would a polyfill like |
Just to follow up, I am only using Faye in one particular part of my Rails app that has its own layout, so I just added |
I really love this project, I use it for browser and node client and server projects.
With current version (1.2.1) building faye with webpack works but fails in runtime (browsers) due to missing "global".
I noticed a few sources (in /protocol/client, /util and /mixins) use "global" as a keyword, specially while calling onbeforeunload() and setTimeout(), which could be fine for node (but why?), but can't work for browsers.
Is there a solution for projects with no direct access to webpack config, i.e. angular/cli?
Perhaps to use more ambivalent checks for window|global, or better, to separate code for browser and node?
The text was updated successfully, but these errors were encountered: