vue.draggable.next
vue.draggable.next copied to clipboard
The requested module '/node_modules/.vite/vue.js?v=d608385f' does not provide an export named 'default'
The following is the robot translation, which may not be accurate. Sorry:
Hello! I use vite to build components that use vue.draggable.next. If I introduce it into the project, an error will be reported:The requested module '/node_modules/.vite/vue.js?v=d608385f' does not provide an export named 'default'.This is my project:https://github.com/yaolunmao/vuedraggable-publish-test
You can reproduce the error this way:
git clone https://github.com/yaolunmao/vuedraggable-publish-test
pnpm i
pnpm run build
//Then copy `dist`folder to `assets/`
pnpm run dev
At this time, the browser will report an error:The requested module '/node_modules/.vite/vue.js?v=d608385f' does not provide an export named 'default'
Then modify Line 8 of App.vue, remove the comments, and then comment the code in line 4 and delete the assets / dist folder. You will find that the project is running normally
Then
npm run build
distfolder will be generated, and the folder will be cut under assetsfolder
Modify Line 8 of App.vueagain, comment this line, and uncomment the code in line 4, and you will find that the project reports an error:The requested module '/node_modules/.vite/vue.js?v=d608385f' does not provide an export named 'default'
original text:
您好!我使用vite构建使用了vue.draggable.next的组件,在项目中引入会报错误:The requested module '/node_modules/.vite/vue.js?v=d608385f' does not provide an export named 'default',这是我的项目:https://github.com/yaolunmao/vuedraggable-publish-test
您可以这么复现
git clone https://github.com/yaolunmao/vuedraggable-publish-test
pnpm i
pnpm run bulid
//然后将生成的`dist`文件夹复制到`assets`文件夹下
pnpm run dev
这时候浏览器会报错:The requested module '/node_modules/.vite/vue.js?v=d608385f' does not provide an export named 'default'
然后修改App.vue第8行,将注释去掉,再将第4行代码注释,删除assets/dist文件夹,您会发现项目正常运行
然后使用
npm run build
将会生成dist文件夹,将文件夹剪切到assets文件夹下面
再修改App.vue第8行,将这行注释,再将第4行代码取消注释,您会发现项目报错:The requested module '/node_modules/.vite/vue.js?v=d608385f' does not provide an export named 'default'
I found that if
import draggable from 'vuedraggable/src/vuedraggable'
project is normal
Same here:
Uncaught SyntaxError: The requested module '/node_modules/.vite/vue.js?v=150b56b8' does not provide an export named 'default'
I found that if
import draggable from 'vuedraggable/src/vuedraggable'project is normal
This does work but it's ugly and it's prone to breaking due to possible changes
Any formal solution for this?
Also ran into this issue, found this thread.
I found that if
import draggable from 'vuedraggable/src/vuedraggable'project is normal
I've implemented this fix, which does work. As others have said, a proper fix would be preferred though, since this seems like a bandaid and not a proper solution.
In our component library repo: we have a <Draggable/> component that has "vuedraggable": "^4.1.0" as a dependency. Works in Storybook just fine. We bundle this component using "vite": "^3.0.3" and publish to our internal GitHub package registry.
When we install our <Draggable/> component in other repos, we get the exact error described in this issue title; that's in Chrome runtime. We're using "vue": "^3.2.37" in all repos.
Any updates on this? @David-Desmaisons
Also ran into this issue, found this thread.
I found that if
import draggable from 'vuedraggable/src/vuedraggable'project is normal
I've implemented this fix, which does work. As others have said, a proper fix would be preferred though, since this seems like a bandaid and not a proper solution.
In our component library repo: we have a
<Draggable/>component that has"vuedraggable": "^4.1.0"as adependency. Works in Storybook just fine. We bundle this component using"vite": "^3.0.3"and publish to our internal GitHub package registry.When we install our
<Draggable/>component in other repos, we get the exact error described in this issue title; that's in Chrome runtime. We're using"vue": "^3.2.37"in all repos.
Hitting the same issue when using in as a Storybook component.
Hello is there any update on this?
I'm facing the same issue.
Using this library on a design library I'm working on, it's working just fine on the design library app, but when it's used by other vue apps (using yarn link), the design library app breaks with the same error message as TS's facing.
I get the same issue. This code of below may temporarily solve the problem, looking forward to updates.
import draggable from 'vuedraggable/src/vuedraggable'
import draggable from 'vuedraggable/src/vuedraggable'
Works for now, if anybody founds a better solution please post. Many Thanks for posting this solution @yaolunmao
I have the same problem when use draggable package inside ui-kit
Workaround
import draggable from 'vuedraggable/src/vuedraggable'