Skip to content
This repository has been archived by the owner on Mar 13, 2018. It is now read-only.

Bad node.js detection #10

Open
dantman opened this issue Mar 2, 2018 · 0 comments
Open

Bad node.js detection #10

dantman opened this issue Mar 2, 2018 · 0 comments

Comments

@dantman
Copy link

dantman commented Mar 2, 2018

stacky uses this code to detect Node.js.

var isNode = new Function('try {return this===global;}catch(e){return false;}');

However this way of detecting node is completely wrong.

First issue, the practical one. If you use the <script> version of babel-polyfill this code will declare that the browser isNode and stacky will attempt to require things.

Second problem, the idealistic one. Adding global to browsers was a proposal that made it to stage-3, i.e. nearly included into the standard and implementation attempted by browsers.

This kind of irresponsible code that equates global to Node.js/CommonJS/require is the reason we're having an issue with getting that to stage-4.

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

1 participant