I get this error: Error: defineAlreadyDefined, that only occurs with dojo.
index.php
<script data-main="app" src="require.js"></script>
app.js
require({
    paths : {
        dojo : 'http://ajax.googleapis.com/ajax/libs/dojo/1.7.1/dojo/dojo'
    }
});
require([ 'dojo' ], function() {
   //something
});
I found a similar question, but didn't help me:
When dojo.js loaded via ajax multiple times get Error: defineAlreadyDefined
EDIT: I searched and I think the way that i am trying to use requiJS and Dojo is wrong. http://dojotoolkit.org/features/1.6/async-modules
Any idea? thanks
In order to use a foreign loader w/ dojo you need to skip the dojo/dojo.js file, which defines the AMD loader. Your require config should have something like:
require({
    packages: [
        {
            name: 'dojo',
            location: 'dojo',
            main:'dojo/main' 
        }
    ]
});
However, the dojo loader is just as good at loading jQuery plugins as requireJS and it comes with a few additional plugins, like dojo/has. I'd give serious thought to just using it's loader.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With