Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Sortable is not a constructor #3

Open
treyan94 opened this issue Oct 8, 2019 · 8 comments
Open

Sortable is not a constructor #3

treyan94 opened this issue Oct 8, 2019 · 8 comments

Comments

@treyan94
Copy link

treyan94 commented Oct 8, 2019

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?

@owen-m1
Copy link
Member

owen-m1 commented Oct 9, 2019

@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.

@dammainikilraj
Copy link

sortable error
facing the same error from long back. could any one help me out on this.

Added screen shot for your reference.

Thanks in advance!

@Padam87
Copy link

Padam87 commented Oct 16, 2019

This issue happens with the newer versions of sortablejs.

Downgraded to 1.9, all fine.

@mariovalney
Copy link

Downgrade is (often) not the best solution.

To 1.10+ try:

/**
 * SortableJS
 */
window.Sortable = require('sortablejs').Sortable;

@dartanian300
Copy link

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

@barbuslex
Copy link

I have the same issue... Anyone have the solution ?

@daocatt
Copy link

daocatt commented Jan 7, 2022

I have the same issue... Anyone have the solution ?

try Sortable.Sortable.

console.log(Sortable) you will see three module.

@raysuelzer
Copy link

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...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

9 participants