Note that there are some explanatory texts on larger screens.

plurals
  1. POHow to locally test cross-domain builds?
    text
    copied!<p>Using the dojo toolkit, what is the proper way of locally testing code that will be executed as cross-domain, without making the actual build?</p> <p>As it appears, there are three <strong>possible options</strong> (each, with their own drawbacks):</p> <ol> <li><strong>Using local (non xd) XMLHttpRequest dojo.require</strong> <ul> <li>This option does not really test the xd behavior, since it dojo.require[s] the js synchronously via XHR.</li> </ul></li> <li><strong>djConfig.debugAtAllCosts = true;</strong> <ul> <li>Although this option does load the required code asynchronously (via the 'script' tag), it also pulls the code in via XHR, parses the dojo.require[s] inside that, and pulls them in. This (using the loader_debug), again, is not what the loader_xd is doing. <a href="https://stackoverflow.com/questions/1899281/dojo-requireif-does-not-allow-local-variables">More info on this topic in a different question.</a></li> </ul></li> <li><strong>Creating a cross-domain build</strong> <ul> <li>This approach requires a build, which is not possible in the environment which I'm running the code in (We're using our own on-the-fly build process, which includes only the js that is necessary for a particular page. This process is not suitable for development). </li> </ul></li> </ol> <p>Thus, my question: is there a way to use the loader_xd, which does not require an xd build (which adds the xd prefix / suffix to every file)?</p> <p>The 2nd way (using the debugAtAllCosts) also makes me question the motivation for pre-parsing the dojo.require[s]. If the loader_xd will not (or rather can not) pre-parse, why is the method that was created for testing/debugging doing so?</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload