Skip to content

Uncaught ReferenceError: global is not defined #915

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

Closed
nikku opened this issue Feb 2, 2015 · 5 comments
Closed

Uncaught ReferenceError: global is not defined #915

nikku opened this issue Feb 2, 2015 · 5 comments
Labels

Comments

@nikku
Copy link

nikku commented Feb 2, 2015

It is not save to rely on global being available in browserified bundles (i.e. users may choose to disable insertion of global variables to keep the bundle minimal.

In case browserify (or webpack) did not expose a global variable support.js throws an error saying

Uncaught ReferenceError: global is not defined

I am not sure what the right approach would be to solve this issue. I would probably check for window as a global variable because that should (?) always be available in DOM environments.

@nikku
Copy link
Author

nikku commented Feb 2, 2015

global is the conventional root in commonJS thought. It may be safe to assume users do not exclude it unless they know what they are doing.

@jdalton jdalton added the wontfix label Feb 2, 2015
@jdalton
Copy link
Member

jdalton commented Feb 2, 2015

global is the conventional root in commonJS thought. It may be safe to assume users do not exclude it unless they know what they are doing.

Right and the lodash-node bundle is a build of lodash explicitly exported as Node.js/io.js modules.

@jdalton jdalton closed this as completed Feb 2, 2015
@nikku
Copy link
Author

nikku commented Feb 5, 2015

Is there any npm compatible build of of lodash that is compatible with the browser + browserify then?

@jdalton
Copy link
Member

jdalton commented Feb 5, 2015

There's lodash and lodash-compat though they only have UMD in the monolithic index.js files and not the other modules included. Browserify has opts.detectGlobals as true by default so things should work. Others have used Browserify with lodash without problems so I think this is a case of using the right Browserify options for the job.

@lock
Copy link

lock bot commented Jan 20, 2019

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@lock lock bot locked as resolved and limited conversation to collaborators Jan 20, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Development

No branches or pull requests

2 participants