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

jquery plugins not loading correctly #60

Open
adrielwerlich opened this issue Dec 27, 2018 · 1 comment
Open

jquery plugins not loading correctly #60

adrielwerlich opened this issue Dec 27, 2018 · 1 comment
Labels

Comments

@adrielwerlich
Copy link

adrielwerlich commented Dec 27, 2018

Hello there.
Awesome dashboard.
I´m getting some error messages like:

found in

---> <TodoList> at c:\Users\adrie\Downloads\vuejsadmin_31a5e23be455ba232\vue2-admin-lte-master\src\widgets\VATodoList.vue
       <Row> at c:\Users\adrie\Downloads\vuejsadmin_31a5e23be455ba232\vue2-admin-lte-master\src\grid\Row.vue
         <Dashboard> at c:\Users\adrie\Downloads\vuejsadmin_31a5e23be455ba232\vue2-admin-lte-master\src\examples\Dashboard.v1.vue
           <VaContentWrap> at c:\Users\adrie\Downloads\vuejsadmin_31a5e23be455ba232\vue2-admin-lte-master\src\ContentWrap.vue
             <App> at c:\Users\adrie\Downloads\vuejsadmin_31a5e23be455ba232\vue2-admin-lte-master\src\MainContent.vue
               <App> at c:\Users\adrie\Downloads\vuejsadmin_31a5e23be455ba232\vue2-admin-lte-master\src\App.vue
                 <Root>```

AND

```TypeError: $(...).find(...).todolist is not a function
    at VueComponent.mounted (VATodoList.vue?68eb:130)
    at callHook (vue.common.js?e881:3036)
    at Object.insert (vue.common.js?e881:4258)
    at invokeInsertHook (vue.common.js?e881:6076)
    at Vue.patch [as __patch__] (vue.common.js?e881:6295)
    at Vue._update (vue.common.js?e881:2776)
    at Vue.updateComponent (vue.common.js?e881:2897)
    at Watcher.get (vue.common.js?e881:3267)
    at new Watcher (vue.common.js?e881:3256)
    at mountComponent (vue.common.js?e881:2904)

a print

image

Of course, this is happenning in my local server...
Ive tried to search in stackoverflow, but nothing yet..
I´m guessing something related with webpack not finding jquery plugins..

@adrielwerlich
Copy link
Author

adrielwerlich commented Dec 27, 2018

I was tryin to solve like following through these steps:
Option #1: Use ProvidePlugin

Add the ProvidePlugin to the plugins array in both build/webpack.dev.conf.js and build/webpack.prod.conf.js so that jQuery becomes globally available to all your modules:

plugins: [

// ...

new webpack.ProvidePlugin({
$: 'jquery',
jquery: 'jquery',
'window.jQuery': 'jquery',
jQuery: 'jquery'
})
]
Option #2: Use Expose Loader module for webpack

As @TremendusApps suggests in his answer, add the Expose Loader package:

npm install expose-loader --save-dev

Use in your entry point main.js like this:

require("expose-loader?$!jquery");

But somethings the error message show´s up again.... I dont know whats the problem with webpack

@devjin0617 devjin0617 added the bug label Jan 29, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants