Skip to content
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

Uncaught ReferenceError: global is not defined using 2.x version in the Browser #338

Closed
lholmquist opened this issue Jun 18, 2019 · 2 comments · Fixed by #341
Closed

Uncaught ReferenceError: global is not defined using 2.x version in the Browser #338

lholmquist opened this issue Jun 18, 2019 · 2 comments · Fixed by #341
Assignees

Comments

@lholmquist
Copy link
Member

lholmquist commented Jun 18, 2019

Node.js Version:

Operating System:

Steps to Produce Error:

using the jQuery example from https://github.com/nodeshift-starters/opossum-examples/tree/master/jquery

I've updated to use Opossum@latest and receive this error in the developer console

opossum.js:10 Uncaught ReferenceError: global is not defined
    at opossum.js:10
(anonymous) @ opossum.js:10

Previously, in the 1.x version, this "global" variable use to be called "window".

There are 2 webpack configs now. one looks to be node only and the other is a web based one.

@helio-frota @lance why are there 2 configs now? It looks like the "opossum.js" that is distributed with the library is a node specific version, and the "browser-test.js" file that gets distributed actually works in the browser. shouldn't we just have on config and one file?

@helio-frota
Copy link
Member

@lholmquist that was our first solution when moving forward with the prometheus integration.

More details about that starting here

@lance
Copy link
Member

lance commented Jun 19, 2019

@lholmquist so I think the webpack configuration that we run for the browser tests should also be generating an opossum.js for browser usage. I didn't look closely enough at what was happening here with the PR that @helio-frota linked above, and since all of the browser tests passed, did not realize that we were no longer generating an opossum.js file for use in the browser. My fault - I don't think there is any need to produce a node specific opossum.js in the dist dir, since node users will just use the package and index.js is the proper entry point for that.

@lance lance self-assigned this Jun 21, 2019
lance added a commit that referenced this issue Jun 21, 2019
The node-specific webpack configuration was overwriting the
config for the browser. Thus the distribution had a non-browser
capable implementation that required some work on the user's
part to get working in the browser. The user's webpack.config
required an external declaration for `prom-client`. For example:
lance/elizabethan-insults@ebabdf3#diff-23fce1009af5652674e09470cda3c008R9

Fixes: #338
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants