Ошибка загрузки popper.js в bootstrap 4 при использовании require.js - PullRequest
0 голосов
/ 10 апреля 2019

Мое веб-приложение AngularJS пытается загрузить bootstrap4, popper и jquery через requirejs следующим образом:

main.js

requirejs.config({
    waitSeconds: 0,
    baseUrl: "js/",
    paths: {
        'angular': 'lib/angular/1.7.8/angular',
        'uiBootstrap': 'lib/angular-ui/3.0.6/ui-bootstrap-tpls-3.0.6',
        'jquery': 'lib/jquery/3.2.1/jquery-3.2.1',
        'popper': 'lib/popperjs/1.12.9/popper.min',
        'bootstrap': 'lib/bootstrap/4.0.0/bootstrap.min'
    },
    shim: {
        'angular':           {deps: ['jquery'], exports: 'angular'},
        'uiBootstrap':       {deps: ['angular']},
        'bootstrap':         {deps: ['jquery', 'popper'], exports: 'bootstrap'}
    }
});

requirejs([
    "angular",
    "bootstrap",
    "app/initials"
],
function(angular) {
    angular.bootstrap(window.document, ['initials']);
});

initials.js

define([
    "angular",
    "uiBootstrap"
],
function(angular) {
    var initials =  angular.module('initials', ['ui.bootstrap', 
                                          'ui.bootstrap.dropdown'
                                      ]);


    return initials;
});

Но приведенная ниже ошибка возникает при проверке консоли браузера. Как я могу настроить requirejs для соответствующей загрузки этих библиотек?

require.min.js:34 GET http://localhost:8080/semfronteiras/popper.js net::ERR_ABORTED 404

require.min.js:8 Uncaught Error: Script error for: popper.js
http://requirejs.org/docs/errors.html#scripterror
    at C (require.min.js:8)
    at HTMLScriptElement.onScriptError (require.min.js:29)

require.min.js:8 Uncaught Error: Script error for: popper.js


jquery-3.2.1.js:3860 jQuery.Deferred exception: $(...).affix is not a function TypeError: $(...).affix is not a function
    at HTMLDocument.<anonymous> (http://localhost:8080/semfronteiras/:111:35)
    at mightThrow (http://localhost:8080/semfronteiras/js/lib/jquery/3.2.1/jquery-3.2.1.js:3583:29)
    at process (http://localhost:8080/semfronteiras/js/lib/jquery/3.2.1/jquery-3.2.1.js:3651:12) undefined

jquery-3.2.1.js:3869 Uncaught TypeError: $(...).affix is not a function
    at HTMLDocument.<anonymous> ((index):111)
    at mightThrow (jquery-3.2.1.js:3583)
    at process (jquery-3.2.1.js:3651)
...