Vue.draggable: Webpack looks for jquery

Created on 16 Feb 2017  路  3Comments  路  Source: SortableJS/Vue.Draggable

Though there should be no dependency on jquery, webpack does exit with the following error:

ERROR  Failed to compile with 1 errors

This dependency was not found in node_modules:

* jquery

Did you forget to run npm install --save for it?

I just use the es6 way:

```
import draggable from 'vuedraggable'
Vue.component('draggable', draggable)
````
Any ideas what could be happening here? Maybe some issue with sortablejs?

Most helpful comment

Alright, found it. I am using lavavel-mix for my webpack configuration and it does the following:

new webpack.ProvidePlugin(Mix.autoload || {
        jQuery: 'jquery',
        $: 'jquery',
        jquery: 'jquery',
        'window.jQuery': 'jquery'
    }),

In Sortable.js, window.jquery is checked and webpack tries to inject due to that plugin. Just needed to delete/comment out the provide plugin and everything is fine again.

All 3 comments

Hello @rootman.
I think it should not be linked with vue.draggable but to other depency in your project.
Here is an application example using vue.draggable and Webpack: draggable-example

As you can see no additional jquery depency is needed.

Hey @David-Desmaisons!

That is the weird thing, it is not linked in any other package that I use. As soon as I comment out the vuedraggable line, it bundles just fine. I did not look at the source of sortablejs yet, however they state that there is no dependency on jquery as well.

Will try standalone without any other packages and work my way in from there maybe.

Alright, found it. I am using lavavel-mix for my webpack configuration and it does the following:

new webpack.ProvidePlugin(Mix.autoload || {
        jQuery: 'jquery',
        $: 'jquery',
        jquery: 'jquery',
        'window.jQuery': 'jquery'
    }),

In Sortable.js, window.jquery is checked and webpack tries to inject due to that plugin. Just needed to delete/comment out the provide plugin and everything is fine again.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

Stetzon picture Stetzon  路  3Comments

parthibeyond picture parthibeyond  路  3Comments

AlexandreBonneau picture AlexandreBonneau  路  3Comments

Kgwkgwkgw picture Kgwkgwkgw  路  3Comments

bborn picture bborn  路  3Comments