mdbootstrap / material-design-for-bootstrap

Important! A new UI Kit version for Bootstrap 5 is available. Access the latest free version via the link below.
https://mdbootstrap.com/docs/standard/
MIT License
9.34k stars 1.15k forks source link

ReferenceError: Waves is not defined #81

Closed iamkumaranca closed 6 years ago

iamkumaranca commented 7 years ago

Getting this error when importing MDB using Webpack Mix.

mattonit commented 7 years ago

Could you please provide us more details? What's your version of MDB? What's the code you tried?

iamkumaranca commented 7 years ago

Laravel Mix Version: 1.4.2 MBD Version: 4.4.1

const { mix } = require('laravel-mix');;

if ( process.env.NODE_ENV == 'production' ) {
    mix.disableNotifications();
}

mix.options( { publicPath: 'public' } );

mix.webpackConfig( {
    devtool: 'source-map',
    resolve: {
        alias: {
            'popper': 'popper.js/dist/umd/popper.js',
            'jquery-ui': 'jquery-ui-dist/jquery-ui.js',
        }
    }
} )
.autoload( {
    jquery: [ '$', 'window.jQuery', 'jQuery', 'jquery' ],
    popper: ['Popper'],
} )
.sass( 'resources/sass/bootstrap.scss', 'public/css' )
.sass( 'resources/sass/mdb.scss', 'public/css' )
.sass( 'resources/sass/font-awesome.scss', 'public/css' )
.sass( 'resources/sass/app.scss', 'public/css' )
.copy( 'node_modules/jquery-ui-dist/jquery-ui.min.css', 'public/css')
.js( './resources/js/app.js', 'public/js/')
.extract( [
     'jquery',
     'jquery-ui',
     'popper',
     'bootstrap',
     'mdbootstrap'
 ] )
.browserSync();
adamgoose commented 7 years ago

I'm experiencing the same issue.

adamgoose commented 7 years ago

Seems to be related to #20, which is super old and has merge conflicts.

adamgoose commented 7 years ago

I was able to get around this by refactoring the Waves factory to simply attach the factory's result to the window.

window.Waves = factory.call(window);
BlackDark commented 7 years ago

Check this solution: https://mdbootstrap.com/support/webpack-support-eta/

01e9 commented 6 years ago

I "fixed" by autoproviding

'Waves': 'node-waves/src/js/waves'
cnocon commented 6 years ago

@arteniioleg Where/what file did you do this in?

01e9 commented 6 years ago

@cnocon https://webpack.js.org/plugins/provide-plugin/