vue-chat-scroll: Require vue-chat-scroll returns empty object

after install the latest version with npm:

> require('vue-chat-scroll')
{}

About this issue

  • Original URL
  • State: closed
  • Created 7 years ago
  • Reactions: 1
  • Comments: 58 (19 by maintainers)

Commits related to this issue

Most upvoted comments

I doesn’t work for me as well. I’m using:

import Vue from 'vue'
import VueChatScroll from 'vue-chat-scroll'
Vue.use(VueChatScroll)

and then

<ul id="chat-messages" v-chat-scroll>

and I’m getting [Vue warn]: Failed to resolve directive: chat-scroll error

Yea, sorry man 😦 I’m using 1.1.1 and having this issue too 😕

From my yarn.lock:

vue-chat-scroll@^1.1.1:
  version "1.1.1"
  resolved "https://registry.yarnpkg.com/vue-chat-scroll/-/vue-chat-scroll-1.1.1.tgz#9d4278fc5d85d98dc3d43e140856c7659b4aaba3"

Doing

import Vue from 'vue'
import VueChatScroll from 'vue-chat-scroll'
Vue.use(VueChatScroll)

does not register the directive, even though console is logging this:

console.log(VueChatScroll)
> Object {}
>   installed: true

Standard const VueChatScroll = require('vue-chat-scroll') logs out as an empty object.

Worked for me once I added Vue.use(require(‘vue-chat-scroll’)) to my main.js. I think the bullet points in the documentation make this step seem optional, since it is same indentation level as the npm install instructions, despite the fact that both are required. Just something to help beginners.

Will eventually fix this… One day. Soon™

i stumbled upon similiar issue with my plugin, hence found this thread while trying to solve it, in my case i added output.libraryTarget: ‘commonjs2’ in webpack.conf in the plugin. Then i can use the plugin just fine with: import * as MyPlugin from ‘my-plugin’ Vue.use(MyPlugin)

might be worth a shot for you guys

Yup understand. It definitely need to be fixed properly. Thanks for the great plugin!

On top of my head, the easiest hack is to remove the line /src in .npmignore and we can happily import src/vue-chat-scroll.js :p For those who uses webpack should bundle the file themselves anyway, so it should not be a problem

@theomessin i actually copied and adapted the code here, just wanted to let you know that there is an issue. it also helpful for others who come across this library, so that they don’t waste their time trying to find out that it’s not working in some setups.

Not for me. I still have the same problem.

I’m getting this as well. I’ll see if I can get a reproducible repo up for you.

This snippet will mute the error about missing directive, but it still doesn’t work 😞

import Vue from 'vue'
window.Vue = Vue
require('vue-chat-scroll')
window.Vue = undefined

I’m experiencing this issue as well. I created a [pen] trying to reproduce my error, but it seems it works fine there 😅

you can find our project here: https://github.com/sarahschuetz/IM531_ProjectT1

we are using vue together with nuxt so I tried implementing it as a Plugin like explained here https://nuxtjs.org/guide/plugins/#__nuxt