Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

The requested module '/node_modules/.vite/deps/vue.js?v=6a4bcc3c' does not provide an export named 'default' #82

Open
mawshin opened this issue Jul 31, 2023 · 2 comments

Comments

@mawshin
Copy link

mawshin commented Jul 31, 2023

I am using vite for development and also to build production JS of components library. I am using vue3-apexcharts for one of the component and it works fine in the npm dev mode. If building the package for production, an error will be reported when using the library in the application:The requested module '/node_modules/.vite/deps/vue.js?v=6a4bcc3c' does not provide an export named 'default'.

Not sure if anyone has encounter this issue before but this would be the common way to import and use vue3-apexcharts:

import apexcharts from "vue3-apexcharts"

But the above will cause error when using the build JS and I have found to fix the issue will have to call the file within the src folder:

import apexcharts from "vue3-apexcharts/src/vue3-apexcharts"

Would be great if anyone knows if it could be a vite build issue or is it something on vue3-apexcharts end which might cause the vite build to have issue.

@amanpatel
Copy link
Contributor

I am also having the same issue. It seems to be a problem with how the project is producing its distributable. Which is in the commonJS format instead of a ES build. Vite is a modern build tool and it has left behind things like commonJS in favor of the modern toolset. This is why you are having this issue.

Unfortunately for me, importing directly from vue3-apexcharts/src/vue3-apexcharts also does not work, so I'm looking at fixing this in another way.

@ShwaibLeBon
Copy link

Hey @mawshin and @amanpatel , you should include "vue3-apexcharts" in vite.config.ts' optimizeDeps option like so:

optimizeDeps: {
	include: ["vue3-apexcharts"],
},

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants