Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adding window, document to IIFE but not not require it for commonJS, use root & root.document instead #25

Open
alvarotrigo opened this issue Jul 19, 2018 · 0 comments

Comments

@alvarotrigo
Copy link

alvarotrigo commented Jul 19, 2018

I would like to include window and document for minification purposes.
As having them in the IIFE will reduce a bit the size of the minified file.

I would like to get something like this:

(function(global, factory) {
    'use strict';
    if (typeof define === 'function' && define.amd) {
        define(['jquery'], function($) {
          return factory($, global, global.document, global.Math);
        });
    } else if (typeof exports === "object" && exports) {
        module.exports = factory(require('jquery'), global, global.document, global.Math);
    } else {
        factory(jQuery, global, global.document, global.Math);
    }
})(typeof window !== 'undefined' ? window : this, function($, window, document, Math, undefined) {

But adding as a dependencies window and document and up creating for commonJS the following:

 module.exports = factory(require('jQuery'), require('root'), require('document'));

Which i believe is not correct and should be instead:

module.exports = factory(require('jquery'), global, global.document);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant