Question

When trying to run my main.js through r.js I'm getting file not found errors for the ember-simple-auth shim.

 Error: ENOENT, no such file or directory '[path_to_webapp]/components/ember-simple-auth/ember-simple-auth/core.js']
 errno: 34,
 code: 'ENOENT',
 path: '[path_to_webapp]/components/ember-simple-auth/ember-simple-auth/core.js',
 syscall: 'open',
 fileName: '[path_to_webapp]/components/ember-simple-auth/ember-simple-auth/core.js',
 moduleTree: [ 'ember-simple-auth', 'js/main' ]

There is a ember-simple-auth.js in the ember-simple-auth directory in which the core module is bundled. This works for development but not when I run it through the optimizer The relevant parts (I think) of my main.js looks like this

require.config({
    baseUrl: '/',
    paths:
    {
        'ember':            'components/ember/ember',
        'ember-simple-auth': 'components/ember-simple-auth/ember-simple-auth',
    },
    shim:
    {
        'ember':
        {
            deps: ['handlebars','jquery'],
            exports: 'Ember'
        },
        'ember-simple-auth' : ['ember']
    }
});


require(['ember-simple-auth']);

The build file

compile:
    options:
        baseUrl: "."
        paths:
            requireLib: 'components/requirejs/require'
        mainConfigFile: "js/main.js"
        name: "js/main"
        include: ['requireLib']
        out: "js/main.min.js"
'compile-css':
    options:
        cssIn: "css/style.css"
        out: "css/style.min.css"
Était-ce utile?

La solution

I ended up using the bundles option which in my case looks like this

bundles:
{
    'ember-simple-auth': ['ember-simple-auth/core','ember-simple-auth/session','ember-simple-auth/authenticators','ember-simple-auth/authorizers','ember-simple-auth/stores','ember-simple-auth/utils','ember-simple-auth/mixins/application_route_mixin','ember-simple-auth/mixins/authenticated_route_mixin','ember-simple-auth/mixins/authentication_route_mixin','ember-simple-auth/mixins/authentication_controller_mixin','ember-simple-auth/mixins/login_controller_mixin','ember-simple-auth/authenticators/base','ember-simple-auth/authorizers/base','ember-simple-auth/stores/base','ember-simple-auth/stores/local_storage','ember-simple-auth/stores/ephemeral','ember-simple-auth/utils/flat_objects_are_equal','ember-simple-auth/utils/is_secure_url']
},
Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top