Sortable is not a constructor
treyan94 opened this issue ยท 8 comments
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.
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.
Is there any way to use a CDN version of sortableJS. I have a simple app and dont' really want to go through setting up an entire build process...