2

我有这种情况:

js/main.js

require.config({
    'baseUrl' : 'js',
    'waitSeconds' : 45,
    'paths': {
        "underscore": "libs/underscore-min",
        "backbone": "libs/backbone-min",
        "text" : "text"
    },
    'shim': {
        backbone: {
            'deps': ['jquery', 'underscore'],
            'exports': 'Backbone'
        },
        underscore: {
            'exports': '_'
        }
    },
    'config': {
        i18n: {
            locale: localStorage.getItem('locale') || 'en-en'
        }
    }
});

require(['underscore', 'backbone', 'app'], function(_, Backbone, app) {

    window.APP = window.APP || {};
    app.init();
});

js/app.js

define(['jquery', 'routers/home'], function($, router) {

    var init = function() {

        APP.router = new router();

        $("body").css({
            overflow: 'hidden'
        });

    };
    return {
        init: init
    };
});

我有这个错误 - 无法读取未定义的属性“规范化”

在某些模块上,我使用 css 插件,并使用文本作为模板。我错过了什么?这个错误是什么意思?谢谢

编辑:这是我的检查员日志:

Uncaught TypeError: Cannot read property 'normalize' of undefined require-jquery.js:929
(anonymous function) require-jquery.js:929
(anonymous function) require-jquery.js:130
(anonymous function) require-jquery.js:1128
each require-jquery.js:58
Module.emit require-jquery.js:1127
Module.check require-jquery.js:899
Module.enable require-jquery.js:1115
Module.init require-jquery.js:758
callGetModule require-jquery.js:1142
context.completeLoad require-jquery.js:1493
context.onScriptLoad require-jquery.js:1620
4

1 回答 1

2

您需要将 jquery 添加到您的路径中:

require.config({
    'baseUrl' : 'js',
    'waitSeconds' : 45,
    'paths': {
        //right here
        "jquery": "path/to/jquery",
        "underscore": "libs/underscore-min",
        "backbone": "libs/backbone-min",
        "text" : "text"
    },
    //other stuff
});
于 2012-12-14T17:56:27.577 回答