Skip to content

The requested module '/node_modules/.vite/vue.js?v=d608385f' does not provide an export named 'default' #117

Open

Description

@yaolunmao

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'

Activity

  1. yaolunmao commented on Jan 24, 2022

    @yaolunmao
    Author

    I found that if

    import draggable from 'vuedraggable/src/vuedraggable'
    
    

    project is normal

  2. dakt commented on Mar 11, 2022

    @dakt

    Same here:

    Uncaught SyntaxError: The requested module '/node_modules/.vite/vue.js?v=150b56b8' does not provide an export named 'default'

  3. dakt commented on Mar 11, 2022

    @dakt

    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

  4. cscan commented on Jul 5, 2022

    @cscan

    Any formal solution for this?

  5. saxoncameron commented on Oct 4, 2022

    @saxoncameron

    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.

  6. Flynamic commented on Jan 23, 2023

    @Flynamic

    Any updates on this? @David-Desmaisons

  7. cmcleese commented on Apr 20, 2023

    @cmcleese

    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.

    Hitting the same issue when using in as a Storybook component.

  8. rifqi96 commented on May 24, 2023

    @rifqi96

    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.

  9. jingyuLin1999 commented on Jun 8, 2023

    @jingyuLin1999

    I get the same issue. This code of below may temporarily solve the problem, looking forward to updates.

    import draggable from 'vuedraggable/src/vuedraggable'
  10. shishirraven commented on Jun 19, 2023

    @shishirraven

    import draggable from 'vuedraggable/src/vuedraggable'

    Works for now, if anybody founds a better solution please post.
    Many Thanks for posting this solution @yaolunmao

  11. nestle49 commented on Oct 17, 2023

    @nestle49

    I have the same problem when use draggable package inside ui-kit

    Workaround
    import draggable from 'vuedraggable/src/vuedraggable'

  12. auirarrazaval commented on Oct 10, 2024

    @auirarrazaval

    I'm having the exact same issue as @rifqi96 . Any updates on this? Considering this issue is over two years old

  13. nicolidin commented on Feb 12, 2025

    @nicolidin

    Got the exact issue, friendly ping @David-Desmaisons do you have any idea of how to fix that issue ?

    It took me 6 hours to understand why it didn't work when draggable was inside a lib.
    (it works in storybook , or directly inside my host project).

    Hope people find this issue more easily than myself.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions