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

Bad node.js detection #10

Open
Open
@dantman

Description

@dantman

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions