Durandal을 사용하여 PhoneGap과 함께 번들로 앱을 제작하고 있습니다. weyland optimizer를 실행할 때 몇 가지 문제가 있습니다. 빌드 및 최적화가 오류없이 잘 실행됩니다 (최적화 도구로 requirejs를 사용하고 있습니다).하지만 응용 프로그램을 실행할 때 내 검도 UI 차트에 "잡히지 않은 TypeError : 개체 [개체 개체]에"kendoChart '메서드가 없습니다 "라는 오류가 발생합니다." .Durandal Weyland/Requirejs optimizer with kendo ui dataviz
kendoChart 바인딩이 발생하는 Chrome에서 디버그 모드로 일시 중지하고 콘솔에 "kendo"를 입력하면 나는 kendoobject를 얻고 그 속성 등을 볼 수 있으므로 확실히 DOM에있게됩니다.
Iv'e google 주위에 상당히 약간의 스레드를 발견했지만 그들 중 아무도 내 문제를 정렬하는 것 같습니다. 예를 들어 this thread 또는 this one입니다.
아래에 제공된 차트에 맞춤 녹아웃 바인딩이 있습니다.
내 weyland.config은 다음과 같습니다
exports.config = function (weyland) {
weyland.build('main')
.task.jshint({
include: 'App/**/*.js'
})
.task.uglifyjs({
// not uglyfying anything now...
//include: ['App/**/*.js', 'Scripts/durandal/**/*.js', 'Scripts/custom/**/*.js']
})
.task.rjs({
include: ['App/**/*.{js,html}', 'Scripts/custom/**/*.js', 'Scripts/jquery/*.js', 'Scripts/durandal/**/*.js'],
exclude: ['Scripts/jquery/jquery-2.0.3.intellisense.js', 'App/main.js'],
loaderPluginExtensionMaps: {
'.html': 'text'
},
rjs: {
name: 'main',
baseUrl: 'App',
paths: {
'text': '../Scripts/text',
'durandal': '../Scripts/durandal',
'plugins': '../Scripts/durandal/plugins',
'transitions': '../Scripts/durandal/transitions',
'knockout': '../Scripts/knockout/knockout-2.3.0',
'kendo': 'empty:', <-- tried refering kendo.all.min, or dataviz.chart or the path
'jquery': '../Scripts/jquery/jquery-2.0.3.min',
'Helpers': '../Scripts/custom/helpers',
........ other scripts ......
},
deps: ['knockout', 'ko_mapping', 'command'],
callback: function (ko, mapping, command) {
ko.mapping = mapping;
}
//findNestedDependencies: true, **<-- tried both true and false here**
inlineText: true,
optimize: 'none',
pragmas: {
build: true
},
stubModules: ['text'],
keepBuildDir: false,
out: 'App/main-built.js'
}
});
};
// The custom binding for the kendo chart
define([
'knockout',
'jquery',
'Helpers',
'kendo/kendo.dataviz.chart.min'
], function (
ko,
$,
helpers,
kendoui
) {
function drawChart(element, values, options) {
$(element).kendoChart({ **<-- this is where I get an error**
... options for chart ...
});
}
// kendoUi data viz chart
ko.bindingHandlers.moodChart = {
init: function (element, valueAccessor, allBindingsAccessor, viewModel, bindingContext) {
//set the default rendering mode to svg
kendo.dataviz.ui.Chart.fn.options.renderAs = "svg"; **<-- this renders no errors**
// if this is a mobile device
if (kendo.support.mobileOS) {
// canvas for chart for you!
kendo.dataviz.ui.Chart.fn.options.renderAs = "canvas";
}
var values = ko.unwrap(valueAccessor());
setTimeout(function() {
drawChart(element, values);
}, 125);
}
};
});
나는 모든 웹 브라우저에서하지 최적화 된 코드 (또는 그 문제에 대한 전화)를 실행 잘 작동하는 것이 추가 할 수 있습니다.
나는 또한 구성 파일에서 검도 경로를 shim하고 jquery에 종속성을 추가하려고 시도했지만 실제로는 차이가없는 것으로 보인다.
도움이 될 것입니다.
일반 스크립트 태그를 통해 jquery, kendo 및 knockout을로드하고 AMD 모듈에서 전혀 처리하지 않으셨습니까? – RainerAtSpirit
아니요. 이제는 이것으로 해결할 수 있지만, 실제로는별로 행복하지는 않습니다. – aup
kendo와 같은 대규모 프레임 워크의 경우 의존성 집합이 있습니다. jquery 버전, 나는 그들 자신의 AMD 모듈과 함께 묶지 않는 경향이있다. 개인 취향, 알아. – RainerAtSpirit