Error: Bootstrap's JavaScript requires jQuery, using Webpack
I finally got rid of the error just by adding a new entry in the ProvidePlugin:
jQuery:"jquery"
so finally the plugin looks like this:
new webpack.ProvidePlugin({
$: "jquery",
jquery: "jquery",
"window.jQuery": "jquery",
jQuery:"jquery"
})
I leave it here in case someone else faces the same problem.
Using Create React App you can import like this:
import 'jquery/src/jquery';
import '../node_modules/bootstrap-sass/assets/javascripts/bootstrap.min';
note: This is for jQuery 3.*
You can also add the Expose Loader package:
npm install expose-loader --save-dev
And use in your webpack entry point (ie. main.js
) like this:
import 'expose?$!expose?jQuery!jquery'
// ...