मैं requjs का उपयोग कर रहा हूं और अपने उत्पाद कलाकृतियों को कॉन्फ़िगर कर रहा हूं, इस प्रकार मेरे पुस्तकालयों को संयोजित कर रहा हूं और उनके बीच मॉड्यूल निर्भरता स्थापित कर रहा हूं ताकि आवश्यकता के लिए गंदे कार्य का उपयोग करके लोडिंग अनुक्रम उपयुक्त हो सके। मुझे अपने लाइवरेलोड सर्वर में रनटाइम मॉड्यूल इंजेक्शन का उपयोग करने में कोई समस्या नहीं है, जिसमें गैर-संयुक्त पुस्तकालयों तक पहुंच है। स्पष्टता के लिए मैंने सभी minification/uglification अक्षम कर दिया है और एक जेएस-beautify चालू कर दिया है।ग्रांट-contrib-requjs से शिम लाइब्रेरी लपेटना नहीं
requirejs: {
dist: {
// Options: https://github.com/jrburke/r.js/blob/master/build/example.build.js
options: {
// `name` and `out` is set by grunt-usemin
// name: 'App',
baseUrl: yeomanConfig.app + '/scripts',
mainConfigFile: yeomanConfig.app + '/scripts/config.js',
out: yeomanConfig.dist + '/scripts/main.js',
optimize: 'none',
// TODO: Figure out how to make sourcemaps work with grunt-usemin
// https://github.com/yeoman/grunt-usemin/issues/30
//generateSourceMaps: true,
// required to support SourceMaps
// http://requirejs.org/docs/errors.html#sourcemapcomments
beautify: false,
removeCombined: false,
generateSourceMaps: false,
preserveLicenseComments: false,
useStrict: true,
mangle: false,
compress: false,
// wrap: true,
// https://github.com/mishoo/UglifyJS2
}
}
},
मैं केंडो, कोणीय, और कोणीय-केनो-यूआई का उपयोग कर रहा हूं। मैं समझता हूं कि केंडो एएमडी-मॉड्यूल तैयार है लेकिन यह एंगुलर-केनो-यूआई जैसा दिखता नहीं है। मैं एक शिम बनाने की उम्मीद कर रहा था और इसे उपयुक्त आवश्यकताओं में परिभाषित किया गया था, हालांकि मुझे यह नहीं लगता कि यह हो रहा है।
define('angular-kendo-ui', [
'angular',
'kendo'
], function (
angular,
kendo
) {
< original angular-kendo-ui source >
});
मैं शिम्स आवेदन गलत समझा है:
require.config({
cjsTranslate: true,
paths: {
jquery: 'vendor/jquery/jquery',
'angular-kendo-ui': 'vendor/angular-kendo-ui/build/angular-kendo',
kendo: 'vendor/kendoui.complete.2013.2.918.trial/js/kendo.all.min',
angular: 'vendor/angular/angular',
requirejs: 'vendor/requirejs/require',
'angular-animate': 'vendor/angular-animate/angular-animate',
'angular-ui-router': 'vendor/angular-ui-router/release/angular-ui-router.min',
'angular-resource': 'vendor/angular-resource/angular-resource'
},
shim: {
jquery: {
exports: '$'
},
angular: {
deps: [
'jquery'
],
exports: 'angular'
},
'angular-resource': {
deps: [
'angular'
]
},
'angular-kendo-ui': {
deps: [
'angular',
'kendo'
]
},
'angular-ui-router': {
deps: [
'angular'
]
}
}
});
मॉड्यूल तैयारी की कमी मैं इसे अपने आप जैसे लपेट हल करने के लिए? ऐसा लगता है कि मेरे पास यह है और यह वास्तव में परिभाषित पथ को लपेटता नहीं है, बल्कि मॉड्यूल से अनुरोध किया जाता है (जो गतिशील मॉड्यूल लोडिंग में ठीक है)
इन तकनीकों की शुरुआती जांच के दौरान मैंने कुछ ऐसा कहा requjs (या मेरी पाइपलाइन में संपत्ति म्यूटेटर में से एक) को स्वचालित रूप से मेरे लिए मॉड्यूल लपेटने का एक तरीका था। किसी के पास मेरे लिए संकेत है, मुझे लगता है कि यह requjs था जो कॉन्फ़िगरेशन में परिभाषित मॉड्यूल को पथ के रूप में परिभाषित करेगा लेकिन शायद मैं गलत था। नीचे कार्यों की एक प्रिंटआउट किया जा रहा भाग गया है:
Done, without errors.
Elapsed time
build 887ms
useminPrepare:html 22ms
concurrent:dist 8s
autoprefixer:dist 174ms
requirejs:dist 19s
jsbeautifier:dist 2s
concat:public/styles/main.css 46ms
concat:public/scripts/main.js 56ms
cssmin:public/styles/main.css 81ms
copy:dist 26ms
usemin:html 5s
usemin:css 24s
डिबगिंग के 3 घंटे से अधिक के बाद, मुझे यह जवाब मिला- धन्यवाद! – LessQuesar