rlemaigre / Easy-DnD

A drag and drop implementation for Vue.js 2 and 3 https://codesandbox.io/s/easy-dnd-demo-9mbij https://codesandbox.io/s/easy-dnd-demo-2-xnqbz
MIT License
380 stars 52 forks source link

Uncaught TypeError in project (.on / .off) #128

Closed duncan-oxd closed 1 year ago

duncan-oxd commented 1 year ago

I'm trying to install this in an existing project, and I'm getting an error:

Uncaught TypeError: Cannot read properties of undefined (reading 'on')

A minimal installation works in CodeSandbox: https://codesandbox.io/s/droplist-forked-mmqm0g?file=/src/App.vue but not in CodePen: https://codepen.io/oxd_duncan/pen/vYappbP (or in my Vue 2 Webpack project)

I'm guessing it has something to do with the transpilation, but I haven't had trouble with any other NPM packages. Am I missing something?

nicholaszuccarelli commented 1 year ago

Sounds like a configuration issue with your project (and how its being imported in codepen). that 'on' error doesn't look like its being called from our package but rather the base Vue2 project itself.

duncan-oxd commented 1 year ago

I think so too, but I can't tell what configuration might be causing it. For what it's worth, I'm pretty sure the code triggering the error is in the created block of the DropList component: https://github.com/rlemaigre/Easy-DnD/blob/36825d0d5aff059bd7e4c81988e14e7703e68e62/lib/src/components/DropList.vue#L165-L167

I haven't yet tried it in a totally fresh Vue 2 project, though. I'll update here if I get a chance to try that.