requirejs jquery 和引导加载顺序

requirejs jquery and boostrap load order

嗨,我有一个关于加载 bootstrap 和 js 的问题:

我有这个代码:

<script>
 var config = {
   paths: {
        "bootstrap": "plugins/bootstrap/js/bootstrap.min"
   },
   'shim': {
        'bootstrap': {
                deps: ['jquery']
        }
    },
 };
 require.config(config);
 require([
    'jquery',
    'bootstrap'
 ], function ($) {  
    $('#accordion-about').collapse();   
 });
</script>

它正确加载了文件,但顺序不正确。 它在 jquery 之前加载 bootstrap 并导致错误: 错误:Bootstrap 的 JavaScript 需要 jQuery

shim 部分不接受来自 paths 的路径,因此它必须是文件的完整路径:

<script>
 var config = {
   paths: {
        "bootstrap": "plugins/bootstrap/js/bootstrap.min"
   },
   'shim': {
        'plugins/bootstrap/js/bootstrap.min': {
                deps: ['jquery']
        }
    },
 };
 require.config(config);
 require([
    'jquery',
    'bootstrap'
 ], function ($) {  
    $('#accordion-about').collapse();   
 });
</script>