bevacqua / dragula

:ok_hand: Drag and drop so simple it hurts
https://bevacqua.github.io/dragula/
MIT License
22.08k stars 1.97k forks source link

js not working after installing with npm #672

Closed Neeraj1005 closed 3 years ago

Neeraj1005 commented 3 years ago

In my laravel project I have installed this package using npm. And for JS/CSS in laravel we use webpack.... but uder my js file I imported this file but drag and drop is not working. If I used the cdn its working.

resources/js/dragula.js

require('./dragula');

webpack.mix.js

const mix = require('laravel-mix');
mix.js('resources/js/app.js', 'public/js')
    .js('resources/js/dragula.js', 'public/js')
    .sass('resources/sass/app.scss', 'public/css')
    .sass('resources/sass/dragula.scss', 'public/css')
    .sourceMaps();

can anyone tells me why isn't working

Neeraj1005 commented 3 years ago

solved after adding this new additional line

resources/js/dragula.js

import dragula from 'dragula';
window.dragula = dragula;