Skip to content

[Question] jQuery inclusion for Bootstrap #54

Closed
@vdeturckheim

Description

@vdeturckheim

Hi,

First of all, thanks a lot for this great starter. It is probably the best and simplest I have found around.
I have an issue in making the jQuery variable global in order to use bootstrap's js.
In my vendor.ts, I have:

// Other vendors for example jQuery, Lodash or Bootstrap
// You can import js, ts, css, sass, ...
import 'jquery/dist/jquery.js'
import 'bootstrap/dist/css/bootstrap.css';
import 'bootstrap/dist/js/bootstrap.js';

I tried using require on jQuery but it always gave me the same error:

Uncaught Error: Bootstrap's JavaScript requires jQuery

Can anyone let me know how to do ?
Thanks a lot !

Activity

tb

tb commented on Mar 7, 2016

@tb
Contributor

Add to webpack config:

plugins: [
    new webpack.ProvidePlugin({
        $: "jquery",
        jquery: "jQuery"
    }),
]
vdeturckheim

vdeturckheim commented on Mar 7, 2016

@vdeturckheim
Author

Thanks a lot !
This worked for me:

new webpack.ProvidePlugin({
        $: "jquery",
        jquery: "jquery",
        jQuery: "jquery",
        "windows.jQuery": "jquery"
    })
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

      Development

      No branches or pull requests

        Participants

        @tb@vdeturckheim

        Issue actions

          [Question] jQuery inclusion for Bootstrap · Issue #54 · preboot/angular-webpack