I have a npm project that uses jquery.
var $ = require(\'jquery\');
I also have an index html file that references bootstrap.
I'm using Laravel Mix (Webpack), so I had to add this alias to webpack.mix.js
:
mix.webpackConfig({
...
resolve: {
...
alias: {
"bootstrap": path.resolve(__dirname, "node_modules/bootstrap/dist/js/bootstrap.min.js"),
}
},
});
My package.json
has "bootstrap": "^4.0.0",
within devDependencies.
Then in my javascript file for my view, I use:
var $ = require('jquery');
window.$ = $;
require('bootstrap');
https://getbootstrap.com/docs/4.0/getting-started/download/#npm also helped.