Work-Together2013
Work-Together2013

Reputation: 1201

Bootstrap 4 via Webpack install

If I install Bootstrap 4 via Webpack like the below in my app.js:

import 'bootstrap';

Do I have to also install jquery and popper.js like:

import 'jquery';

import popper from 'popper.js';

Or are the already pulled as peer dependencies from my package.json?

The reason I ask is because I had initially did an import for all 3 files. However, I did a test with just the import 'bootstrap' and everything still seemed to work fine.

Upvotes: 2

Views: 207

Answers (1)

Christian Santos
Christian Santos

Reputation: 5456

jQuery and popper.js are defined as peerDependencies in the Bootstrap package.json:

"peerDependencies": {
  "jquery": "1.9.1 - 3",
  "popper.js": "^1.12.9"
},

So when you run npm install, you'll get a warning if either of those 2 dependencies are not already installed. To install them, you'd run:

npm install --save jquery popper.js

Otherwise, you already have them installed. You can look inside of your node_modules folder for installed dependencies.

See the relevant Bootstrap documentation here.

Upvotes: 1

Related Questions