Skip to content

Update the 'global' check algorithm to latest umdjs guided #27

@fuweichin

Description

@fuweichin

Overview:
gulp-umd templates is out of sync with umdjs templates.

The Problem:
As the 'global' check algorithm gulp-umd currently using in templates is deprecated, files generated gulp-umd have two serious problems:

  • cannot be loaded with native ES module loader
    import '/node_modules/js-untar/build/dist/untar.js';
  • not working properly in Firefox browser extension environment

The error looks like:

Cannot set property 'xxx' of undefined

because the outer this, or argument root in IIF, is undefined

see InvokIT/js-untar#30 and markedjs/marked#1292

Possible Solution:
Update the global check algorithm to umdjs's latest recommended way.

say, replace this with typeof self !== 'undefined' ? self : this, see returnExportsGlobal.js for example.

This is a serious problem, plz patch latest 3 versions (2.x, 1.x anf 0.2.x), also set deprecated tag on old versions at npm central registry.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions