PatrickJS / angular-md5

md5 for Angular.js and Gravatar filter
MIT License
132 stars 55 forks source link

Support Webpack + CommonJS Package Manager #8

Closed benoror closed 9 years ago

benoror commented 9 years ago

Hi Patrick!

I am learning Webpack + ES6 and in the process porting my app (main ideas taken from here, also here and @kentcdodds's egghead screencasts).

This package is a dependency of my project. Basically I want to be able to implement the following ES6 code:

import './login.css';

import angular from 'angular';
import uirouter from 'angular-ui-router';
import md5 from 'angular-md5'; /** this **/

import routing from './login.routes';
import LoginCtrl from './login.controller';

export default angular.module('app.main.login', [
        uirouter,
        md5
    ])
  .config(routing)
  .controller('LoginCtrl', LoginCtrl)
  .name;

I've tried using the following code to support it:

if (typeof module !== "undefined" && typeof exports !== "undefined" && module.exports === exports){
  module.exports = 'angular-md5';
}

*Source: ui-router release

Actually I updated another old dependency this same way, and worked fine: https://github.com/benoror/angular-urlify/commit/affc74b6ad8837d4aa88f3d0153dd70a717d2c6f

I tried the same with angular-md5: https://github.com/benoror/angular-md5/blob/master/lib/index.js#L2

But for some reason webpack compiles it wrong, and throws the following error:

md5

I can make a PR to support it, I just need some advice.

Thanks in advance. Cheers!

benoror commented 9 years ago

Hi Patrick,

It needed some simple refactoring, I fixed it in the build target: https://github.com/gdi2290/angular-md5/compare/master...benoror:master

Apparently the issue is with the Grunt tooling, when building & concatenating, but I'm not sure which to blame.

PatrickJS commented 9 years ago

can you make a pull-request?

benoror commented 9 years ago

Done, I made the adjustments for uglify

PatrickJS commented 9 years ago

repo updated as v0.1.8