Bug concerning load order in package.js api.AddFiles

Hey guys,

I’ve encountered a problem with the load order using api.addFiles in package.js files.

// This works as expected
api.addFiles([
  'client/foobar.html',
  'client/foobar.js',
], ['client']);

// This throws an Error: "TypeError: Template.foobar is undefined"
api.addFiles([
  'client/foobar.js',
  'client/foobar.html',
], ['client']);

I’ve made a example repo here: https://github.com/illmat/packageAddFilesBug.
It’s not a big deal, but it should be either fixed or mentioned in the docs.

Did you depend on the templating package in your package.js?

Yes, as you can see here:
https://github.com/illmat/packageAddFilesBug/blob/master/packages/example/package.js

I think this is understandable because the template that helper/event/onXXX code refer to within the js file will have only be created within the html file when it is built.

But it would be much better if meteor’s build process prioritized processing of html files regardless of their declared load orders.