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

Webpack compatibility #110

Open
ptitdam2001 opened this issue Jun 19, 2017 · 5 comments
Open

Webpack compatibility #110

ptitdam2001 opened this issue Jun 19, 2017 · 5 comments

Comments

@ptitdam2001
Copy link

Hi!
It will be fun if the module is compatible with RequireJS/Webpack

@hexadecy
Copy link

Is this enough?

From PR #99

  var isElectron = window && window.process && window.process.type;
  if (typeof define === 'function' && define.amd) {
    define(['moment'], ngMaterialDatePicker);
  } else if (typeof module !== 'undefined' && module && module.exports && (typeof require === 'function') && !isElectron) {
    module.exports = ngMaterialDatePicker(require('moment'));
  } else {
    ngMaterialDatePicker((typeof global !== 'undefined' ? global : window).moment);
  }

@ptitdam2001
Copy link
Author

It looks like good!

@hexadecy
Copy link

Ok please test v1.6.6

@ptitdam2001
Copy link
Author

ptitdam2001 commented Jun 28, 2017

Hi,

I'm just testing 1.6.6 version using webpack.
It is OK when you do a require('ng-material-datetimepicker'); but in general when you use require, it returns the name of module.

For example :

var ngMaterialDatetimepicker = require('ng-material-datetimepicker');

angular.module('mainModule', [ngMaterialDatetimepicker]);

It fails because your constructor return nothing. You should return the variable moduleName value at the end of function ngMaterialDatePicker(moment), it will resolve the issue

hexadecy added a commit to beenote/angular-material-datetimepicker that referenced this issue Jun 29, 2017
@hexadecy
Copy link

@ptitdam2001 is this ok?

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

2 participants