baywet baywet - 21 days ago 13
AngularJS Question

bundling angular-permission with webpack

I'm currently in the process of migrating an AngularJS (1.5.8) from a Gulp pipeline to a webpack pipeline.

One of the dependencies we have is angular-permission.

We're relying on the commonjs style (require) and as documented here I added a require('angular-permission') before the declaration of my angular module.

I also added the angular dependencies permission and permission.ui right after ui.router.

The bundling process goes through, however every time we try to load the app we have this error message in the console:

Unknown provider: PermissionStoreProvider <- PermissionStore(…)


I guess the problem is because angular-permission is not injecting the services properly but even playing with the require statement, adding provide plugin or few other attempts didn't solve the issue.

So the question is: how can I properly integrate angular-permission with webpack?

Answer

Finally found out what it was with the help of a friend. During my transition from bower to npm for client side deps I unintentionally changed the version of angular permission to the latest. And they changed the name of the service to PermPermissionStore (same thing for Role Store)

Related: https://github.com/Narzerus/angular-permission/issues/310