Laravel-mix: The '$().modal is not a function' error in my project when I use 'bootstrap-sass'.

Created on 22 Feb 2017  路  4Comments  路  Source: JeffreyWay/laravel-mix

  • Laravel Mix Version: 0.8.0
  • Node Version (node -v): 6.9.4
  • NPM Version (npm -v): 4.2.0
  • OS: mac

Description:

I add the module of 'modal' to the bootstrap in my 'bootstrap-sass'. But there is always a error that is '$().modal is not a function' in my console.

Steps To Reproduce:

in my bootstrap-sass

image

## in my webpack.mix.js:

mix.js(['resources/assets/js/app/app.js',
'resources/vendor/layer/layer.js',
'resources/assets/js/app/main.js'
], 'public/js/app.js')
.extract(['jquery', 'bootstrap-sass', 'bootstrap-datepicker', 'admin-lte', 'lodash', 'vue']);

# in my php file
image

# *in my console*
image

Thanks for your help!

Most helpful comment

Dirty hack:

In your app.js

 window.$ = jQuery; // jQuery - global variable inside your js application.

All 4 comments

Hi,
did you ever find solution for this? I'm facing a similiar issue :)

Dirty hack:

In your app.js

 window.$ = jQuery; // jQuery - global variable inside your js application.

@Glorian Man you saved my life. Really.

Hi. also:
import $ from 'jquery';

Was this page helpful?
0 / 5 - 0 ratings

Related issues

dtheb picture dtheb  路  3Comments

sdebacker picture sdebacker  路  3Comments

rderimay picture rderimay  路  3Comments

rlewkowicz picture rlewkowicz  路  3Comments

terion-name picture terion-name  路  3Comments