gsklee / ngStorage

localStorage and sessionStorage done right for AngularJS.
MIT License
2.33k stars 461 forks source link

Fixing module for webpack/browserify #95

Closed outring closed 9 years ago

outring commented 9 years ago

When using Angular with webpack/browserify there's a good way to define module dependencies using required module name. But your module doesn't return anything and there's no way to get it's name.

var angular = require("angular");
var app = angular.module("app", [require("ngStorage").name]);

Now it does :)

egilkh commented 9 years ago

Thanks for this. I (not really a user of webpack/browserify/commonjs/umd) are looking into this problem.

We have 2 issues/pr on this already and would like to find a solution that benefits most of these. UMD seems to be what is most decent. Currently working on writing tests for it.

sompylasar commented 9 years ago

Refs #89 #90 #91 #92

henrytseng commented 9 years ago

+1 for the AMD implementation referenced @somepylasar especially for ngStorage use with browserify.

The resulting implementation is to otherwise use:

var angular = require('angular');
require("ngStorage");

angular.module('adminApp', [
  'ngStorage'
]);

What everyone wants to do is:

angular.module('adminApp', [
  require("ngStorage")
]);