auth0 / angular-auth0

Angular 1.x Wrapper for Auth0.js v9 and higher
MIT License
24 stars 22 forks source link

Problems with webpack 1 and ES6 #9

Closed jfmercer closed 7 years ago

jfmercer commented 7 years ago

With webpack 1 and ES6, and I cannot replace auth0-angular with angular-auth0.

Previously, my auth0 module looked like this:

import * as angular from 'angular';

import 'auth0-js';
import auth0 from 'auth0-angular';

export default angular.module('authZero', [
  auth0
]).name;

In webpack, I used to the ProvidePlugin to make Auth0 globally available on the window object:

new webpack.ProvidePlugin({
  'window.Auth0': 'auth0-js'
})

With angular-auth0, depending on my configuration, I get a variety of errors. I compared angular-auth0 with auth0-angular to see why one worked with webpack module bundling & the other did not. I suspect that the difference is that auth0-angular uses node's standard module.exports syntax:

require('./build/auth0-angular.js');
module.exports = 'auth0';

Could angular-auth0 be changed to add compatibility standard node module bundling tools, such as webpack? I could put in a PR for this if you think it worthwhile.

chenkie commented 7 years ago

Definitely, PRs are welcome :)

jfmercer commented 7 years ago

@chenkie Please see #11, which will probably solve this issue.

chenkie commented 7 years ago

Thanks for your PR @jfmercer. Merged.