1

When including Bootstrap 4 in my RequireJS config to be included in my application I get the following warning:

Loading failed for the with source “https://crmpicco.localhost/app/app_dev.php/en/portal/view/ksldjfkldsjfklsdjflkj/popper.js”.

and the following error:

Error: Script error for "popper.js", needed by: bootstrap https://requirejs.org/docs/errors.html#scripterror

when using Bootstrap 4 with RequireJS/AMD and I cannot work out how to resolve it.

require = {
    paths: {
        jquery: '/app/assets/vendor/jquery/dist/jquery.min',
        popper: '//cdnjs.cloudflare.com/ajax/libs/popper.js/1.11.0/umd/popper.min',
        bootstrap: '/app/assets/vendor/bootstrap/dist/js/bootstrap.min',
    }
}

I have also tried dropping the <script> tag for popper.js right into the source before my compiled JavaScript is included, but it has no effect.

What am I missing?

crmpicco
  • 16,605
  • 26
  • 134
  • 210

1 Answers1

0

I solved this issue by doing the following...

I am using Yarn, so I included popper.js with yarn add popper.js

then adjusted my RequireJS config.js:

require = {
    baseUrl: '/app/assets/js',
    paths: {
        jquery: '/app/assets/vendor/jquery/dist/jquery.min',
        popper: '/app/assets/vendor/popper.js/dist/umd/popper.min',
        bootstrap: '/app/assets/vendor/bootstrap/dist/js/bootstrap.bundle.min'
    },
    shim: {
        bootstrap: {
            deps: [
                'jquery',
                'popper'
            ]
        }
    }
}
crmpicco
  • 16,605
  • 26
  • 134
  • 210