Closed epotvin closed 9 years ago
@epotvin, do you mean that the correct load order should be to sort dependencies by depth and later by it's order on bower.json file? Can you give an example of correct and incorrect load order to make it clearer?
Thanks!
Hi @gbisheimer! Thanks for your answer.
I mean that dependencies should be sorted by their own dependencies, assuring them to be added to the header only when all their dependencies are.
I made an example : https://github.com/epotvin/bower-sorting-example
In this particular case, the fullcalendar package is loaded before momentjs, which is one of its dependencies. The html header generated is ordered like this :
<script type="text/javascript" src="/bower-sorting-example.js?c2e184d448010d8345127ffbaf10ce04b6d355e3"></script>
<script type="text/javascript" src="/packages/bower/jquery/dist/jquery.js?0fed45ad7a48ace869bc725ca474ad86a1ef1562"></script>
<script type="text/javascript" src="/packages/bower/fullcalendar/dist/fullcalendar.js?04db7e4bf2be0dbeca82fa2c5b44fb5e1f67fecb"></script>
<script type="text/javascript" src="/packages/bower/moment/moment.js?7c81bcf301af241126f325337eebd90c5b67467b"></script>
<script type="text/javascript" src="/packages/bower/angular/angular.js?a06c5b4d77f681fdc444d35d20bc438b091cc690"></script>
<script type="text/javascript" src="/packages/bower/angular-ui-calendar/src/calendar.js?9ae60f95c55ca0a5a828da3a371da7c848d39c61"></script>
<script type="text/javascript" src="/packages/bower/angular-bootstrap-datetimepicker/src/js/datetimepicker.js?d533af07055d9e521f0358767b08edba58dcaa95"></script>
You can see that fullcalendar is effectively loaded before moment.
Does a workaround already exists other then putting the moment dependency in another bower.json file in a sub folder? Actually, I don't even care about moment.js. I just want it because fullcalendar does.
Manu
If you try with my fixed meteor-bower package (https://github.com/epotvin/meteor-bower), you will have :
<script type="text/javascript" src="/bower-sorting-example.js?c2e184d448010d8345127ffbaf10ce04b6d355e3"></script>
<script type="text/javascript" src="/packages/bower/angular/angular.js?a06c5b4d77f681fdc444d35d20bc438b091cc690"></script>
<script type="text/javascript" src="/packages/bower/moment/moment.js?7c81bcf301af241126f325337eebd90c5b67467b"></script>
<script type="text/javascript" src="/packages/bower/jquery/dist/jquery.js?0fed45ad7a48ace869bc725ca474ad86a1ef1562"></script>
<script type="text/javascript" src="/packages/bower/angular-bootstrap-datetimepicker/src/js/datetimepicker.js?d533af07055d9e521f0358767b08edba58dcaa95"></script>
<script type="text/javascript" src="/packages/bower/fullcalendar/dist/fullcalendar.js?04db7e4bf2be0dbeca82fa2c5b44fb5e1f67fecb"></script>
<script type="text/javascript" src="/packages/bower/angular-ui-calendar/src/calendar.js?9ae60f95c55ca0a5a828da3a371da7c848d39c61"></script>
which successfully resolve the issue.
Manu
With some dependencies (in my case fullcalendar), some sub dependencies are not loaded in the right order (in my case moment.js). Actually, dependencies are loaded and sorted by deepness of the bower.json file, but it makes the workaround for my problem a little complex.
I suggest that once the dependencies are loaded, that they'll be sorted according to their dependencies.
I just tried something for that and it seems to work. I'm proposing a pull request right away.
Emmanuel