Giter Club home page Giter Club logo

gulp-umd's People

Contributors

amercier avatar codeman99 avatar eduardolundgren avatar pedronauck avatar sankethkatta avatar talyssonoc avatar whenderson avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

gulp-umd's Issues

Problem using SystemJS/JSPM?

Hi,
I am using SystemJS to load my modules, this means that the wrapper sets module.exports, and then exits the conditions. That leaves the root.angularSchemaFormDynamicSelect undefined, which causes an "Uncaught (in promise) Uncaught ReferenceError: angularSchemaFormDynamicSelect is not defined" when the wrapper tries to return it in the end, code:

;(function(root, factory) {
  if (typeof define === 'function' && define.amd) {
    define(['angular-schema-form'], factory);
  } else if (typeof exports === 'object') {
    module.exports = factory(require('angular-schema-form')); //Happens
  } else {
    root.angularSchemaFormDynamicSelect = factory(root.schemaForm);  //Never happens
  }
}(this, function(schemaForm) {

.........my code...............

return angularSchemaFormDynamicSelect; // This is undefined.
}));

That said, I am not sure I understand the UMD model completely..

sourcemaps support

Hi Eduardo,

Any chance of adding sourcemaps support? I've got a pending pull request which adds it if that's helpful?

Can it add CJS like module wrapping support?

Write module using CommonJS style:

var moduleA = require('./a');
var moduleB = require('./b');

console.log(moduleA.ver);

moduleB.someFunc();

module.exports = {
  ver: '2.0'
};

Then automatically transport dependencies from the require. Finally, wrap it to UMD:

(function(root, factory) {
  if (typeof define === 'function' && define.amd) {
    define(['require', 'exports', 'module', './a', './b'], factory);
  } else if (typeof exports === 'object') {
    module.exports = factory();
  } else {
    // I'm not sure how to do in global.
    // root.Foo = factory();
  }
}(this, function(require, exports, module) {
  var moduleA = require('./a');
  var moduleB = require('./b');

  console.log(moduleA.ver);

  moduleB.someFunc();

  module.exports = {
    ver: '2.0'
  };
}));

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

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);

export default with another export

this scenario doesn't work.. I have a file which exports one function as default and one without, example:

//...some code..
export default foo
export bar

and I want to consume both at the same time, naturally, like so:

import foo, {bar} from "file.js"

Problem is, the README doesn't address this and I couldn't find any example of how the exports setting should be written. currently it's:

exports: function(file) {
 return 'foo';
}

Thanks!

More documentation on dependencies

Would it be possible to provide an (realistic) example of how let's say angular1.x and jquery can be included as dependencies, in the string-based and object-based form?

Problem using with es6

Hi, first of all thanks for the wonderful build script!
I'm facing and issue when trying to build the module against transpiled es6 and also against es6. If that is beyond the project can you give me some suggestions? I have exhausted all my options for this. Thanks.

Update the 'global' check algorithm to latest umdjs guided

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.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.