0
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.

zloctb
  • 10,592
  • 8
  • 70
  • 89

1 Answers1

1

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

Community
  • 1
  • 1
Roman Goyenko
  • 6,965
  • 5
  • 48
  • 81