How to prevent loading of knockout.js by requirejs? -


i'm using requirejs loading majority modules, need load single script knockout.js old-fashioned manner using:

<script src='/path/to/knockout.js' ></script> 

i have trouble it, when page rendered see markup:

<script async="async" type="text/javascript" src="knockout.min.js"></script> 

but don't want load knockout using require.js.

how disable loading using require.js specified script?


i found solution:

after digging sources of knockout, found interesting pice of code, determine existance of require.js , automatically registers module in require, here guilty chunk of code:

    // support 3 module loading scenarios if (typeof require === 'function' && typeof exports === 'object' && typeof module === 'object') {     // [1] commonjs/node.js     var target = module['exports'] || exports; // module.exports node.js     factory(target); } else if (typeof define === 'function' && define['amd']) {     // [2] amd anonymous module     define(['exports'], factory); } else {     // [3] no module loader (plain <script> tag) - put directly in global namespace     factory(window['ko'] = {}); } 

you can change want (for example can replace function else) achieve executing last else branch of code, , result ko registered in global window space.


Comments

Popular posts from this blog

c++ - Creating new partition disk winapi -

Android Prevent Bluetooth Pairing Dialog -

VBA function to include CDATA -