-
Notifications
You must be signed in to change notification settings - Fork 216
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Uncaught Error: Multiple anonymous defines encountered #243
Comments
Hello @thomaswhite, The answer to this problem is likely inside your files that you've converted to AMD. Be sure that each file contains exactly one Your configuration looks good, except for a few minor points:
-- John |
John, Thank you for your help. I followed your instructions and now the code loads and works (using legacy It seams is some sort of a timing/caching issue. If I disable the cache (in Where shell I start from? Thomas Thomas White Mobile:+44 7711 922 966 On 9 December 2013 14:56, John Hann notifications@github.com wrote:
|
Oh, I just remembered: another thing that can cause this issue is if an AMD module is loaded with a |
Feel free to re-paste your new config so I can see. |
And paste a sample of one of your modules while you're pasting things. :) |
Here are the config and the defines
ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.js",
// This does not work :-(
extra) { ---------- the the bottom of dust-core-2.2.2.js ------ if (typeof define === "function" && define.amd) { --- local-content --- --- main --- --- detect-bottom --- pages --- tiny-pubsub I think the problem comes from: The error messages stopped when I changed the requires from Looking at the debug log the required module is requested early at the Is it possible the module requests initiated by the legacy loader to be Thomas Thomas White Mobile:+44 7711 922 966 On 9 December 2013 22:53, John Hann notifications@github.com wrote:
|
page.js looks like it may be a problem. From your code snippets, I can't see how it's configured. It's a named module, which means it must have a path mapped to it or it must be at the baseUrl. I don't see a path configured for it. The exports property of dest-templates looks strange. Seems like you want to use a factory there instead of an exports? https://github.com/cujojs/curl/blob/master/src/curl/loader/legacy.js#L20 Does dust-templates have a
We've tested transitive dependencies pretty thoroughly, so I'm skeptical. :) It might just be a timing fluke that stopped the error. If so, it will come back again. |
John, I have prepared a zip file with all my files which you can use to reproduce Thomas Thomas White Mobile:+44 7711 922 966 On 10 December 2013 17:31, John Hann notifications@github.com wrote:
|
After many tries and re-factoring I still have this error randomly from time to time. I think there are some timing issues that unfortunately have not been covered by the tests. I fail to understand why we throw an exception and stop the whole process of loading instead of try to recover from the error. Requesting a file that has been already requested is something to be avoided but can be easily recovered. I love the ideas, the architecture, the packages, the plugin mechanism and the variety of files to be loaded by curl.js. You guys have done a great work. There are just a couple of small things left to be polished. It is a shame not to have the resources to complete such a good work. I am giving up on curl.js because the random errors do not give me confidence to use it in my projects. Thomas |
I am getting the same error and is driving me insane :). The problems seems to be related to the text plugin, as soon as it tries to load the plugin I am getting the error. Seems like it does not like that the plugin itself is unnamed... any tips about what could be the problem? |
Hey @manast. Can you provide some more context? Perhaps open another github issue, or start a discussion on #cujojs (freenode) or google groups? |
@unscriptable yes. I will do that. I think that the problem arises when you use a plugin within a define context, but I need to reproduce it in a simple test case:
I will confirm this as soon as I have a few minutes. regards, Manuel. |
For anyone else encountering this error in the future, see also #283. |
I am migrating a set of plain JS modules to AMD and I am having fun.
At one point I started receiving an error "Uncaught Error: Multiple anonymous defines encountered" and I am stack.
I switched to the debug version of curl and I can see the error is not consistent with one specific file - when I reload the page the error can be for one or another js file.
I use jQuery version of the recent curl from the dist folder.
This is my code:
Any ideas?
The text was updated successfully, but these errors were encountered: