Skip to content
This repository has been archived by the owner on Aug 4, 2021. It is now read-only.

improve global object #50

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

improve global object #50

calvinmetcalf opened this issue Mar 14, 2016 · 2 comments

Comments

@calvinmetcalf
Copy link
Contributor

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
Copy link
Member

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
Copy link
Contributor Author

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
This issue was closed.
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants