gowravshekar / bootstrap-webpack

bootstrap package for webpack
MIT License
136 stars 22 forks source link

Handle Bootstrap's jQuery dependency #7

Closed wosc closed 9 years ago

wosc commented 9 years ago

Straight up with a require("bootstrap-webpack"); my browser says "ReferenceError: jQuery is not defined" with most of Bootstrap's script modules.

I've added jquery as a dependency in package.json and this in webpack.config.js to fix it:

module: {
    loaders: [
        {
            test: /\/bootstrap\/js\//,
            loader: "imports?jQuery=jquery"
        },
}
gowravshekar commented 9 years ago

You need to expose the (jquery, $) variables for other third party libraries to use. Use this in your entry script

require('expose?$!expose?jQuery!jquery');

Also webpack as an argument called --display-error-details that will help you debug stuff like this.