vue.draggable.next icon indicating copy to clipboard operation
vue.draggable.next copied to clipboard

TypeError: isFunction is not a function in vue3 esm environment

Open cimchd opened this issue 2 years ago • 6 comments

I have a vue3 project hat uses es-modules ("type" = "module" in package.json)

// package.json
{
  // ...
  "type": "module"
}

I tried to use vuedraggable in v4.1.0 inside a component:

<script setup lang="ts">
import vuedraggable from 'vuedraggable';
</script>

<template>
  <div>Test</div>
</template>

After this import (even without using it afterwards) I get the following error: image

I looked into the module export of vuedraggable and it seems that there is no real esm export. Instead it uses the umd export. Maybe this is the reasoon why this error occurs.

cimchd avatar Mar 10 '22 09:03 cimchd

https://github.com/SortableJS/vue.draggable.next/issues/132

xlzy520 avatar May 15 '22 08:05 xlzy520

Same here, have you found any solution?

pimkle avatar Mar 14 '24 16:03 pimkle

Same here, have you found any solution?

code-mouse avatar Mar 20 '24 02:03 code-mouse

我也遇到了这个问题,在我的场景下,不是 vuedraggable 的问题。 isFunction 是 vue3 的 shared utils ,我们项目用了 autoimports ,比如 vue 的 createApp 就会 auto import. 我在 src/main.ts 最上面加上了

import { createApp } from 'vue'; 

就可以了,猜想可能是因为 autoImports 的存在导致 vuedraggable 加载的时候 vue 还没加载,所以报错如此。

daolanfler avatar Apr 25 '24 03:04 daolanfler