0

I'm using require-jquery.js and i'm trying to add jquery-ui to the mix.

If i use this definition on my main page i get jquery-ui properly:

// load main app
        require( { paths: {
            'jqueryui': 'cafe/lib/jqueryui',
            'ca': 'cafe/ca',
            'ko': 'cafe/lib/knockout/knockout',
            'komap': 'cafe/lib/knockout/knockout.mapping',
            'kopost': 'cafe/lib/knockout/knockout-postbox',
            'jd': 'cafe/lib/jaydata-1.2.5/jaydata',
            'jdKo': 'cafe/lib/jaydata-1.2.5/jaydatamodules/knockout',
            'jdDeferred': 'cafe/lib/jaydata-1.2.5/jaydatamodules/deferred',
        },
        waitSeconds: 60,
        shim: {
            'jd': { exports: '$data', deps: [ 'cafe/lib/jaydata-1.2.5/datajs-1.0.3' ] },
            'jdDeferred': { exports: '$data', deps: [ 'jd' ] },
        }
    }, [ 'jquery',  'ko', 'cafe/log', 'sp/app','jqueryui' ], function($, ko, log, app ) {
        //this logs the ui object properly
        console.log($.ui);

    } );

But when i try calling it from another module like this:

define(['jquery', 'ko','jqueryui'], function ($, ko) 

I get an error from require.js : Uncaught TypeError: Object 0 has no method 'match'.

What am I doing wrong?

4

1 に答える 1

0

構成オブジェクトを別のrequire.config呼び出し に配置してみてください。

require.config({
  paths : { ... }
});

RequireJS 構成に関するこのページも参照してください。

于 2013-01-20T09:46:26.637 に答える