Closed cschram closed 11 years ago
These should be loading in parallel but executing in order (without shim
). We’ll look into it and fix it if it’s not working correctly.
I’ve confirmed that the loader is not working in the way it should be working for non-AMD modules. This will be resolved for 1.1.
@Abjorn This has been implemented using an AMD loader plugin (intern/order
), rather than shim
, because:
dojo2-core
loader today, I can’t make the same changes to the Dojo 1 loader, so there would be a functional incongruity between the two branches for several months.This feature will be available in 1.1, or if you are tracking master you can use it today. define(['intern/order!my/parentJavascript.js', 'intern/order!my/childJavascript.js' ], …)
Thanks for the report!
In my use case, the use of shim
is in the interest of using third party libraries, rather than a lack of dependency management in the codebase itself. The problem arises where the project is using Require.js and jQuery, and Intern uses Dojo and it's AMD loader.
My codebase uses shim
for third-party modules, so that I have them included in the arguments for a modules factory function. This becomes a problem when trying to use the Dojo loader without shim support - I could still access these libraries from window
but because they're included in a factory function's arguments it gets overridden as undefined
. I could use a work around, like checking for undefined dependencies and grabbing them from window
, but ideally the test suite I'm using shouldn't force me to change my code for the testing environment.
I can change my code to work this way today, but I think in the future it should be supported by Intern via plugin (like the now defunct use plugin for Require.js) for compatibility-sake, unless you're only interested in officially supporting Dojo-based projects.
Hi Abjorn,
Those third party libraries are the code that I was referring to in point 1.
This is not a Dojo issue or a Dojo loader issue. Dojo 1, Dojo 2, curl.js, bdLoad, lsjs, almond.js, inject, pinf, NeedsJS, and brequire all do not implement shim
. RequireJS is the only client-side AMD loader that I know of that implements this functionality. I am absolutely interested in supporting testing of as much code as possible, but I want to do so in a way that is also as responsible as possible.
If you really need shim
for your own project, Intern does not use any Dojo-loader-specific functionality, so you can modify your client.html
to use require.js instead and it should work just fine. I would strongly suggest that you contact plugin authors and request that they add proper AMD support to their libraries so you do not need any extra configuration to use them.
There doesn't appear to be any way to handle non-AMD dependencies (i.e. jQuery plugins) in Intern, since the AMD shim configuration isn't supported by the Dojo loader (https://github.com/csnover/dojo2-core/issues/9).
I'm winding up with jQuery plugins that are not loaded correctly because they're loaded before jQuery.