I'm having trouble configuring Bootstrap 4 beta in an Aurelia CLI app (v0.31.1) with requirejs and using TypeScript. After having tried several config variations I keep on getting the following console error:
Uncaught Error: Bootstrap dropdown require Popper.js
Here are the steps to reproduce. First, install the packages:
$ npm install --save jquery bootstrap@4.0.0-beta popper.js
Next, I've configured aurelia.json:
"jquery",
{
"name": "popper.js",
"path": "../node_modules/popper.js/dist/umd",
"main": "popper"
},
{
"name": "bootstrap",
"path": "../node_modules/bootstrap/dist",
"main": "js/bootstrap.min",
"deps": [
"jquery",
"popper.js"
],
"exports": "$",
"resources": [
"css/bootstrap.css"
]
}
Notice in the config above that:
- popper.js is registered before bootstrap
- the UMD module is used
- popper.js is set as a dependency for bootstrap, next to jquery
Finally, in my app.ts:
import 'bootstrap';
With this configuration, building using au build
works fine. But upon running, using au run --watch
I get the following console errors:
Uncaught Error: Bootstrap dropdown require Popper.js (https://popper.js.org) (defaults.js:19)
Uncaught Error: Bootstrap dropdown require Popper.js (https://popper.js.org) (bootstrap.min.js:6)
... a bit further on:
Uncaught TypeError: plugin.load is not a function at Module. (defaults.js:19)
Unfortunately, the Bootstrap 4 docs only mention instructions on webpack. So does a search on both Aurelia's Gitter.im channel and on StackOverflow. I cannot find samples regarding Aurelia CLI with Require.js. Finally, Google hits shows only examples for embedding the alpha versions (which relied on 'tethering' rather than 'popper').
Similar questions on SO, which have the same error but aren't applicable to my situation:
- Bootstrap 4 Beta importing Popper.js with Webpack 3.x throws Popper is not a constructor
- Angular 4 Bootstrap dropdown require Popper.js
- And several more...
So, my question: how can I configure Bootstrap 4 with Popper.js in an Aurelia CLI app (using Require.js, not Webpack)?
Thanks.