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

improve global object #50

Closed
calvinmetcalf opened this issue Mar 14, 2016 · 2 comments

Comments

Projects
None yet
2 participants
@calvinmetcalf
Copy link
Contributor

commented Mar 14, 2016

currently it will fail if we are in a web worker or in an unknown situation in strict mode

compare what this module adds

typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : this;

with what browserify adds

typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}

how I'd recommend switching to the browserify version

@TrySound

This comment has been minimized.

Copy link
Member

commented Mar 14, 2016

What is the reason for this order? I think window is the most unsafe case and should be processed first. self is a bit similar so should be the secod.

calvinmetcalf added a commit to calvinmetcalf/rollup-plugin-commonjs that referenced this issue Mar 14, 2016

calvinmetcalf added a commit to calvinmetcalf/rollup-plugin-commonjs that referenced this issue Mar 14, 2016

calvinmetcalf added a commit to calvinmetcalf/rollup-plugin-commonjs that referenced this issue Mar 14, 2016

@calvinmetcalf

This comment has been minimized.

Copy link
Contributor Author

commented Mar 14, 2016

I used a different ordering in the actual pull based on me thinking code was likely going to be run in a browser, node, or a web worker in that order

calvinmetcalf added a commit to calvinmetcalf/rollup-plugin-commonjs that referenced this issue Mar 14, 2016

calvinmetcalf added a commit to calvinmetcalf/rollup-plugin-commonjs that referenced this issue Mar 14, 2016

@TrySound TrySound closed this Mar 14, 2016

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.