jquery-sortablejs
jquery-sortablejs copied to clipboard
Sortable is not a constructor
I keep getting Sortable is not a constructor
when using it with Webpack in Laravel.
import Sortable from 'sortablejs';
import 'jquery-sortablejs';
window.Sortable = Sortable;
window.$ = window.jQuery = require('jquery');
It works fine when I use CDN. What could be causing this?
@treyan94 Are you importing it in a NodeJS context?
And why do you have window.Sortable = Sortable
? Sortable adds itself to the window when you import it.
facing the same error from long back. could any one help me out on this.
Added screen shot for your reference.
Thanks in advance!
This issue happens with the newer versions of sortablejs.
Downgraded to 1.9, all fine.
Downgrade is (often) not the best solution.
To 1.10+ try:
/**
* SortableJS
*/
window.Sortable = require('sortablejs').Sortable;
I'm having the same issue but @mariovalney's answer isn't working. Still getting the Sortable is not a constructor
error. Any thoughts?
window.Sortable = require('sortablejs').Sortable;
import 'jquery-sortablejs';
jquery sortable: v1.0.1 sortablejs: v1.14.0
I have the same issue... Anyone have the solution ?
I have the same issue... Anyone have the solution ?
try Sortable.Sortable.
console.log(Sortable) you will see three module.