angular-material-datetimepicker icon indicating copy to clipboard operation
angular-material-datetimepicker copied to clipboard

Webpack compatibility

Open ptitdam2001 opened this issue 8 years ago • 5 comments

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

ptitdam2001 avatar Jun 19 '17 12:06 ptitdam2001

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

hexadecy avatar Jun 20 '17 03:06 hexadecy

It looks like good!

ptitdam2001 avatar Jun 20 '17 12:06 ptitdam2001

Ok please test v1.6.6

hexadecy avatar Jun 24 '17 04:06 hexadecy

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

ptitdam2001 avatar Jun 28 '17 19:06 ptitdam2001

@ptitdam2001 is this ok?

hexadecy avatar Jun 29 '17 16:06 hexadecy