Skip to content

Become resilient to lack of global variable #401

Closed
@Andarist

Description

@Andarist

Huge amount of users are compiling the lib from the source code when using bundlers like webpack, rollup and probably others.

Having a global variable is not guaranteed! I.e. with webpack3 we can specify node: false option to stop any node specific polyfills being added to the bundle - this makes global undefined and thus this lib stops working.

Imho we shouldnt rely on having it because it requires bundlers / users to provide it.

I'm committed to making a PR fixing this, but first I would like to establish if its something you would like to follow and how this should be accomplished - i.e. by wrapping detecting what global is in a module and importing it whenever we need it, or maybe some simple checks against undefined would suffice - but that needs more investigation later.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions