Closed rustemtopcu closed 4 years ago
Hi @rustemtopcu, I remove the entire lodash from dependency of vue-lodash, are you following the new setup to install lodash and pass it on plugin install? Seems like this._
is undefined in this case, which means registration is un successful.
You can look at this (example)[https://github.com/Ewocker/vue-lodash/blob/master/test/src/index.ts] for usage (this is a example with tree shaking).
Please let me know if you have further question.
I'm having the same issue. Not sure how to update to the new setup.
window._ = require('lodash')
import VueLodash from 'vue-lodash'
Vue.use(VueLodash)
Works now. For default settings, we should use
Vue.use(VueLodash, { lodash: lodash })
@ravensnowbird , is this still a problem for you?
I have problem with error window is not defined
on version 2.1.1
I use on nuxt.js
before i use 2.0.2 it's no problem.
I have problem with error
window is not defined
on version 2.1.1 I use on nuxt.js before i use 2.0.2 it's no problem.
forget to post screenshot.
@joey91133 , are you doing SSR? Otherwise window is suppose to be there for any open browser.
@joey91133 , I will make the fix soon. This should only affect those who using nuxt I believe.
yes, I use on SSR.
@joey91133 can you also tell me how you are using it with nuxt? As a plugin (which I believe has a way to disable ssr) or directly using as external package. See https://nuxtjs.org/guide/plugins/
Yes, Please update the documentation. I moved to a new server and kept getting "You have to install lodash" in the console.
And I use it in many methods so obviously my app was DOA :lol:.
@ravensnowbird , is this still a problem for you?
If I don't do what @ravensnowbird suggests I get:
error: 'lodash' is defined but never used (no-unused-vars) at src/main.js:21:8:
19 | import VueIntro from "vue-introjs"
20 | import VueLodash from "vue-lodash"
> 21 | import lodash from "lodash"
| ^
22 | import Vuelidate from "vuelidate"
23 | import VuelidateErrorExtractor, { templates } from "vuelidate-error-extractor"
24 | import VueFormWizard from "vue-form-wizard"
e.g.:
Vue.use(VueLodash, { lodash: lodash })
@ghenry, you have to, that is how Vue register its plugin. This is the change made for the new release, so it is required. Also, what you get is not (no-unused-vars) which is not really an error, it is probably how you setup your Linter (or ts-config) that is reporting for you.
I think the conversation has diverged, the only issue needs to be fixed here is the SSR support. General usage has no problem as far as from what I see. If you have any problem during update, please look at the README file for what is changed https://github.com/Ewocker/vue-lodash/blob/master/README.md Opening SSR support #13
When we update from 2.0.0 to new version we get "Uncaught TypeError: Cannot read property 'forEach' of undefined" from this._.foreach/find statements. When we downgrade to 2.0.0 it works.
Thanks.