2013-05-17 6 views
8

मेरे डोजो आवेदन टूटता है, के निर्माण एप्लिकेशन को लोड करने के दौरान, फेंकने 'multipleDefine' और इस त्रुटि देने के बाद:डोजो 1.9 निर्माण 'multipleDefine' त्रुटि लोड करते समय स्थान

Error {src: "dojoLoader", info: Object}

संदेश: multipleDefine

info: Object {pid: "dojo", mid: "dojo/nls/dojo_en-us", pack: Object, url: "dojo/nls/dojo_en-us.js", executed: 5…}

var profile = { 
// `basePath` is relative to the directory containing this profile file; in this case, it is being set to the 
// src/ directory, which is the same place as the `baseUrl` directory in the loader configuration. (If you change 
// this, you will also need to update run.js.) 
basePath: '../src/', 

// This is the directory within the release directory where built packages will be placed. The release directory 
// itself is defined by `build.sh`. You should probably not use this; it is a legacy option dating back to Dojo 
// 0.4. 
// If you do use this, you will need to update build.sh, too. 
// releaseName: '', 

// Builds a new release. 
action: 'release', 

// Strips all comments and whitespace from CSS files and inlines @imports where possible. 
//cssOptimize: 'comments', 

// Excludes tests, demos, and original template files from being included in the built version. 
mini: true, 

// Uses Closure Compiler as the JavaScript minifier. This can also be set to "shrinksafe" to use ShrinkSafe, 
// though ShrinkSafe is deprecated and not recommended. 
// This option defaults to "" (no compression) if not provided. 
optimize: '', 

// We're building layers, so we need to set the minifier to use for those, too. 
// This defaults to "shrinksafe" if not provided. 
//layerOptimize: 'closure', 
layerOptimize: '', 

// Strips all calls to console functions within the code. You can also set this to "warn" to strip everything 
// but console.error, and any other truthy value to strip everything but console.warn and console.error. 
// This defaults to "normal" (strip all but warn and error) if not provided. 
stripConsole: 'all', 

// The default selector engine is not included by default in a dojo.js build in order to make mobile builds 
// smaller. We add it back here to avoid that extra HTTP request. There is also a "lite" selector available; if 
// you use that, you will need to set the `selectorEngine` property in `app/run.js`, too. (The "lite" engine is 
// only suitable if you are not supporting IE7 and earlier.) 
selectorEngine: 'acme', 


//localeList:"en-gb,en-us,de-de,es-es,fr-fr,it-it,pt-br,ko-kr,zh-tw,zh-cn,ja-jp", 

// Builds can be split into multiple different JavaScript files called "layers". This allows applications to 
// defer loading large sections of code until they are actually required while still allowing multiple modules to 
// be compiled into a single file. 
layers: { 
    // This is the main loader module. It is a little special because it is treated like an AMD module even though 
    // it is actually just plain JavaScript. There is some extra magic in the build system specifically for this 
    // module ID. 
    'dojo/dojo': { 
     // In addition to the loader `dojo/dojo` and the loader configuration file `app/run`, we are also including 
     // the main application `app/main` and the `dojo/i18n` and `dojo/domReady` modules because, while they are 
     // all conditional dependencies in `app/main`, we do not want to have to make extra HTTP requests for such 
     // tiny files. 
     include: [ 'dojo/i18n', 'dojo/domReady', 'app/main', 'app/run' ], 

     // By default, the build system will try to include `dojo/main` in the built `dojo/dojo` layer, which adds 
     // a bunch of stuff we do not want or need. We want the initial script load to be as small and quick to 
     // load as possible, so we configure it as a custom, bootable base. 
     boot: true, 
     customBase: true 
    }, 
}, 

// Providing hints to the build system allows code to be conditionally removed on a more granular level than 
// simple module dependencies can allow. This is especially useful for creating tiny mobile builds. 
// Keep in mind that dead code removal only happens in minifiers that support it! Currently, only Closure Compiler 
// to the Dojo build system with dead code removal. 
// A documented list of has-flags in use within the toolkit can be found at 
// <http://dojotoolkit.org/reference-guide/dojo/has.html>. 
staticHasFeatures: { 
    // The trace & log APIs are used for debugging the loader, so we do not need them in the build. 
    'dojo-trace-api': 0, 
    'dojo-log-api': 0, 

    // This causes normally private loader data to be exposed for debugging. In a release build, we do not need 
    // that either. 
    'dojo-publish-privates': 0, 

    // This application is pure AMD, so get rid of the legacy loader. 
    'dojo-sync-loader': 0, 

    // `dojo-xhr-factory` relies on `dojo-sync-loader`, which we have removed. 
    'dojo-xhr-factory': 0, 

    // We are not loading tests in production, so we can get rid of some test sniffing code. 
    'dojo-test-sniff': 0 
} 

}

:

यहाँ मेरी प्रोफ़ाइल है

और यहाँ src अंदर index.html/

NOTE: build.sh is responsible for removing the "isDebug" flag when deploying to production. If you modify this flag at all, you will break the build!

<script data-dojo-config="async: 1, tlmSiblingOfDojo: 0, locale:'en_US', isDebug: 1" src="dojo/dojo.js"></script> 

<!-- Load the loader configuration script. Note that this module ID is hard-coded in build.sh in order to provide 
    an optimised build that loads as few as one script for the entire application. If you change the name or 
    location of this module, you will need to update build.sh too. --> 
<script src="app/run.js"></script> 
इस

जिले में index.html उत्पन्न होता है/

<!DOCTYPE html> 
<html> 
    <head> 
     <meta charset="utf-8"> 
     <link rel="stylesheet" href="app/resources/app.css"> 
    </head> 
    <body class="claro"> 
     <script data-dojo-config= 
      "async: 1, tlmSiblingOfDojo: 0, locale:'en_US', deps:['app/run']" 
      src="dojo/dojo.js"></script> 
    </body> 
</html> 

मैं बनाने के लिए जाँच की है सुनिश्चित करें कि डोजो/NLS/dojo_en-us.js मौजूद है और यह ठीक है। मैं इस बिंदु पर फंस गया हूँ, कोई सुराग नहीं है!

इस समस्या को ठीक करने में कोई मदद की सराहना की जाती है।

+0

यह सुनिश्चित नहीं है कि आपने इसे ठीक करने में कामयाब रहे हैं लेकिन एकाधिक डीफिन बिल्डर डालने वाले मॉड्यूल पहचानकर्ताओं के कारण हो सकता है। देखें: http://stackoverflow.com/questions/10897480/dojo-build-1-7-built-packages-does-not-work/13136546#13136546 –

उत्तर

0

क्या आप run.js में अपनी आवश्यकताएं पोस्ट कर सकते हैं? क्या आपको वहां "डोजो/_बेस/कॉन्फ़िगर" की आवश्यकता थी?

[सिर्फ एक ही त्रुटि देखा क्योंकि मैं इसे भूल गया;)]

डॉक्स से :

It is important to note the distinction between dojoConfig and dojo/_base/config. dojoConfig is purely for input purposes—this is how we communicate configuration parameters to the loader and modules. During the bootstrap process, dojo/_base/config is populated from these parameters for later lookup by module code.

0

मैं त्रुटि के साथ एक समान मुद्दा था

multipleDefine

जब कोशिश कर रहा मेरी डोजो परियोजना में ग्रीन्सॉक लाइब्रेरी शामिल करने के लिए।

समस्या तब प्रकट होती है जब डोजो के बाहर एक और लाइब्रेरी ने अपना खुद का define फ़ंक्शन घोषित किया (मेरे मामले में टिनमैक्स) क्योंकि वे डोजो लोडर के साथ संघर्ष करते थे।

एक समाधान यह सुनिश्चित करना है कि आपकी लाइब्रेरी या स्क्रिप्ट के बाद डोजो लोडर को कॉल किया गया है जो define फ़ंक्शन का उपयोग करता है।

तो डोजो एचटीएमएल head में लोड करने के लिए अपनी स्क्रिप्ट में नवीनतम होना चाहिए:

<head> 
    <script src="yourLibrary.js"></script> 
    <script src="dojo/dojo.js"></script> 
</head> 

यह समस्या jQuery UI और अन्य पुस्तकालयों का उपयोग कर भी दिख रहा है।

0

लोडर दस्तावेज़ीकरण में इस बारे में एक नोट है (वैसे भी इस प्रतिक्रिया के समय)।

multipleDefine
AMD define was called referencing a module that has already been defined. The most common cause of this problem is loading modules via elements in the HTML document. Use the loader; don't use elements. The second most common cause is passing explicit module identifiers to define; don't do this either.

https://dojotoolkit.org/reference-guide/1.10/loader/amd.html

कई पुस्तकालयों अब UMD जो मूल रूप से करने की कोशिश करेंगे लागू एक एएमडी लोडर के अस्तित्व स्वत: पता लगाएं। उदाहरण के लिए, बूटस्ट्रैप - लोकप्रिय फ्रंट-एंड फ्रेमवर्क - यूएमडी लागू करता है।

तो निम्न उदाहरण (ध्यान दें कि बूटस्ट्रैप विश्व स्तर पर लोड होगा) काम करेगा:

<script src="path/to/bootstrap.js"></script><!--UMD packaged library--> 
<script src="path/to/dojo/dojo.js"></script><!--then dojo loader--> 

लेकिन दूसरे उदाहरण नीचे काम नहीं करेंगे, क्योंकि UMD कोड एएमडी लोडर की पहचान करेगा और उसका उपयोग ही रजिस्टर करने के लिए । यह दस्तावेज के अनुसार एकाधिक परिभाषा त्रुटि ट्रिगर करेगा।

<script src="path/to/dojo/dojo.js"></script><!--dojo loader first--> 
<script src="path/to/bootstrap.js"></script><!--then UMD library--> 

यदि आप वैश्विक स्तर पर लाइब्रेरी लोड करना चाहते हैं तो ऊपर दिए गए पहले उदाहरण का उपयोग करें और इसे डोजो लोडर को बोफोरे लोड करें। यदि आप पुस्तकालय को एएमडी मॉड्यूल के रूप में लोड करना चाहते हैं, तो लोडर का उपयोग करें।

संबंधित मुद्दे