r.js无法找到ember-simple-auth shim的文件

时间:2014-05-15 13:59:09

标签: javascript ember.js requirejs r.js

当试图通过r.js运行我的main.js时,我发现了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' ]

ember-simple-auth目录中有一个ember-simple-auth.js,核心模块捆绑在该目录中。这适用于开发,但不适用于我通过优化器运行它 我的main.js的相关部分(我认为)看起来像这样

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']);

构建文件

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"

1 个答案:

答案 0 :(得分:0)

我最终使用的bundles选项在我的案例中看起来像这样

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']
},