[Solved] How to specify load order?

I’m creating a package that has several JS files. Let’s say that they need to be included in this order: file1.js, file2.js, file3.js, because file1.js defines an object that’s referenced in file3.js. So I’ve done this:

  api.addFiles([
    'client/file1.js',
    'client/file2.js',
    'client/file3.js'
  ], 'client');

And sadly it doesn’t obey that order, because I get errors about objects not being defined. I’ve searched and can’t find anything anywhere about forcing load order. How does this work?

Oops, stupid gotcha. Just noticed the JS package I’m porting used var to declare the object, thus scoping it locally. var removed, all is well!

1 Like