gsklee / ngStorage

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

Doesn't work with Browserify #181

Open rafakato opened 8 years ago

rafakato commented 8 years ago

Hello,

When I load your module in my project, I get this error in console:

Uncaught Error: Cannot find module 'angular'

After inspecting the code I saw that the error throw here: https://github.com/gsklee/ngStorage/blob/master/ngStorage.js#L7

I need to do something your module to work with browserify?

Thanks in advance

egilkh commented 8 years ago

Shouldn't be anything special. Have you included angular?

rafakato commented 8 years ago

Yes,

I've configured the shim for both angular and ngstorage, I also use ui-router and angular-permissions modules with no problem. But when I add your module it throws an error.

To make things work for me I've modified the order of the startup: https://github.com/rafakato/ngStorage/blob/master/ngStorage.js#L1-L11

If there is a angular in the window object I use it instead of loading it from require.

Again, this works for me, but I didn't make any tests. I've just done this so I can your module. When I have some time I'll try to go deeper in this error.

coryisakson commented 8 years ago

I have the same issue uglify. Changing the order of startup like rafakato fixed it for me as well.

M-Beliaev commented 8 years ago

Unfortunately, it does not helps in my case (

Browserify Error { [Error: Cannot find module 'angular' from <...> bower_components/ngstorage ...
abachuk commented 8 years ago

Same here { [Error: Cannot find module 'angular' from <...> bower_components/ngstorage ...