define("file2",['file1'],function(){console.log('World')})
file2.js
var oli={name:boo.joni};
file1.js
var boo={joni:100};
I want to included the file "file2", before it needs to be loaded "file1". Once all scripts must call callbacks. It does not work.
Looks like you need javascript loader with dependencies, take a look here for example:
http://www.dustindiaz.com/scriptjs
There are also some answers here: JavaScript dependency management How do I include a JavaScript file in another JavaScript file? Javascript dependency solution with arbitrary ordered includes
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.