0

I'm working on adding 'ember-simple-auth' to an EAK/grunt-based ember app, upgraded to ember 1.10. Bower is pulling in the latest 'simple-auth.js', not the old 'ember-simple-auth.js' version which the 'ember app kit simple auth' example uses. The component seems to be registered with Ember OK, since if I include the js file in index.html, I get a warning that it's already registered. One of the most basic things to do in getting started with simple-auth is to import the ApplicationRouteMixin into the ApplicationRoute, but I get 'module is not defined' or 'cannot be found'. I've tried many versions of syntax which I've seen in examples and blogs. Like 'import ApplicationRouteMixin from 'simple-auth/mixins/application-route-mixin' with ApplicationRouteMixin or SimpleAuth.ApplicationRouteMixin or Ember.SimpleAuth.ApplicationRouteMixin. Marco suggests I may need to load 'simple-auth.amd', since EAK-based apps transpile ES6 modules to AMD for loading in today's browsers. But I thought Ember Resolver handles that. I don't know how to set the grunt build to export one module over another. The old version adds the component to the namespace with 'Ember.SimpleAuth = Ember.Namespace.create', but the new versions don't have that syntax. How can I get the ember 'simple-auth' mixins imported into my Routes & Controllers?

bobvan
  • 251
  • 3
  • 9
  • The project uses the lightweight AMD 'stefanpenner/loader.js', which appears to be 'Ember CLI' oriented now, so tried building with an old version of 'loader' but saw no improvement. I dropped in the old version of ember-simple-auth, and now I can add the mixin to the Route directly with 'Ember.SimpleAuth.ApplicationRouteMixin', as is done in 'app kit simple auth', but ES6-style import doesn't work. – bobvan Apr 01 '15 at 17:09
  • Something has fundamentally changed in the way the simple-auth module was done and exported/loaded for EAK and how it is now. With all the module specs like CommonJS, ADM, Browserfy and ES6, I can't figure out which way is up. I know that 'simple-auth' is registered with ember, but I can't even find out how to reference or introspect anything within it. – bobvan Apr 01 '15 at 17:09

1 Answers1

0

I also tried dropping the separate mixin files into the project and was able to import/reference them that way but then there was an error about beforeModel needs to call _super so this because an uphill battle with no support or documentation so I had to give up on it. Both of my ember projects are upgraded to the latest Ember and jQuery so now am working on migrating them to CLI, then will revisit simple-auth again, since that's the only approach which might work.

bobvan
  • 251
  • 3
  • 9