2
필요 : 그러나내가 내 기본 응용 프로그램 파일에 r.js을 실행하여 나의 JS 응용 프로그램을 필요로 컴파일을 시도 r.js을 사용하고 노드와 JS와 jQuery를
$ r.js js/bootstrap.js
, 내가 jQuery를 함께 오류를 얻고있다 :
Error: Evaluating www/js/lib/jquery_plugins/slider.js as module "slider" failed with error: ReferenceError: jQuery is not defined
그래서 파일은 다음과 같습니다,이 때문에 내 슬라이더 플러그인에 jQuery를에 대한 참조입니다 알고 있지만, 나는 이것이 내 bootstrap.js 파일에 심으로 jQuery를 추가하여 해결 될 수 있다고 생각 :
// Require JS bootstrap file
require.config({
paths: {
jquery: 'lib/jquery',
backbone: 'lib/backbone',
backboneLocalStorage: 'lib/backbone.localStorage',
underscore: 'lib/underscore',
util: 'lib/util',
config: 'config',
lang: 'lang',
hammer: 'lib/hammer',
moment: 'lib/jquery_plugins/moment',
slider: 'lib/jquery_plugins/slider'
},
shim: {
jquery: {
exports: '$'
},
underscore: {
exports: '_'
},
backbone: {
deps: ['underscore'],
exports: 'Backbone'
},
hammer: {
deps: ['jquery'],
exports: 'Hammer'
}
}
});
// load the app
require(['app'], function(App) {
if(navigator.userAgent.indexOf("Chrome")) {
// then I am running on my local host on chrome
// so force device ready
onDeviceReady();
}
document.addEventListener('deviceready', onDeviceReady, false);
function onDeviceReady() {
App.initialize();
}
});
$ 대신 jQuery로 내보내기를 시도했지만 아무 것도 변경하지 않았습니다.
: 평가 WWW를/JS/lib 디렉토리/jquery.js 모듈 "JQuery와"오류와 함께 실패로 : ReferenceError가 : 창 정의되지 않았다', 어떤 생각? –
shim에서 jquery : {exports : '$'}를 제거 할 수 있습니까? –
제거했을 때 여전히 동일한 오류가 표시됩니다. 또한'jquery : [ 'jquery']'를 시도해 보았습니다. 그러면'Shim config가 노드에서 지원되지 않습니다. 작동하지 않을 수도 있습니다. 모듈 감지 : 밑줄 노드에서 심박동 설정이 지원되지 않거나 작동하지 않을 수 있습니다. 모듈 감지 : 백본 '을 선택하고 backbone.localStorage.js에 윈도우가 정의되지 않은 오류가 발생합니다. –