-
-
Notifications
You must be signed in to change notification settings - Fork 5.1k
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
Requested module does not provide export named 'default' #13247
Comments
This seems to be solved by disabling 'optimizeDeps' on this module: import { defineNuxtConfig } from 'nuxt3'
// https://v3.nuxtjs.org/docs/directory-structure/nuxt.config
export default defineNuxtConfig({
build: {
transpile: ["class-validator"],
},
vite: {
optimizeDeps: {
exclude: ['class-validator']
}
}
}) |
NO it's not, the problem still exits |
I found a workaround for this issue by using Webpack instead of Vite. you can enable Webpack by setting vite to false in nuxt.config.ts
but you should remove the |
same +1 |
Is there any progress about using |
Webpack works good, but added pug, pug-plain-loader, vue-demi... Vite better then webpack, but should works. |
Same here - can we please get an update if this is being looked at? |
Here's a workaround until nuxt/framework#5398 is merged. export default defineNuxtConfig({
alias: {
'class-validator': 'class-validator/cjs/index.js',
},
}) |
Awesome!!!! |
I am still facing similar issue with Environment:
ReproductionPlease checkout this reproduction link
Describe the bugI'm trying to use @amcharts/amcharts5 to create a world map chart similar to the one described here. This error shows up in the client:
I inspected the The code builds without issue and works perfectly in production mode. The problem only exists in the development mode just like this issue mentioned here. |
@danielroe Thank you. Added these settings to vite config and it is working fine now:
|
Hello 😄 After updating from "Uncaught SyntaxError: The requested module 'nuxt/@fs/D:/Projects/studiomado/backoffice/node_modules/.vite/deps/vue.js?v=d26ca8db' does not provide an export named 'Component' (at imports.mjs:4:716)" The line in the imports.mjs file is: export { withCtx, withDirectives, withKeys, withMemo, withModifiers, withScopeId, onActivated, onBeforeMount, onBeforeUnmount, onBeforeUpdate, onDeactivated, onErrorCaptured, onMounted, onRenderTracked, onRenderTriggered, onServerPrefetch, onUnmounted, onUpdated, computed, customRef, isProxy, isReactive, isReadonly, isRef, markRaw, proxyRefs, reactive, readonly, ref, shallowReactive, shallowReadonly, shallowRef, toRaw, toRef, toRefs, triggerRef, unref, watch, watchEffect, isShallow, effect, effectScope, getCurrentScope, onScopeDispose, defineComponent, defineAsyncComponent, resolveComponent, getCurrentInstance, h, inject, nextTick, provide, useAttrs, useCssModule, useCssVars, useSlots, useTransitionState, Component, ComponentPublicInstance, ComputedRef, InjectionKey, PropType, Ref, VNode } from 'nuxt/@fs/D:/Projects/studiomado/backoffice/node_modules/.vite/deps/vue.js?v=d26ca8db'; Any solutions @danielroe ? :) |
Would you open a new issue with a reproduction? 🙏 |
Of course I can do it, i need just a couple of days, i will ping you back in here later! Thank you! 😄 |
With Nuxt version export { withCtx, withDirectives, withKeys, withMemo, withModifiers, withScopeId, onActivated, onBeforeMount, onBeforeUnmount, onBeforeUpdate, onDeactivated, onErrorCaptured, onMounted, onRenderTracked, onRenderTriggered, onServerPrefetch, onUnmounted, onUpdated, computed, customRef, isProxy, isReactive, isReadonly, isRef, markRaw, proxyRefs, reactive, readonly, ref, shallowReactive, shallowReadonly, shallowRef, toRaw, toRef, toRefs, triggerRef, unref, watch, watchEffect, isShallow, effect, effectScope, getCurrentScope, onScopeDispose, defineComponent, defineAsyncComponent, resolveComponent, getCurrentInstance, h, inject, nextTick, provide, useAttrs, useCssModule, useCssVars, useSlots, useTransitionState } from 'vue'; With no 'Component' 🤔 |
Ok @danielroe !! I did it!! 😄 HERE the Github repo (synchronized with Codesandbox) Step to reproduce:
|
@LuXDAmore You have Nuxt 2 as a dependency in your project: https://github.com/LuXDAmore/nuxt3-component-vite-bug/blob/main/package.json#L84 |
@danielroe Sorry, i copy/pasted wrong 😆! But in the original project this package was not installed.. |
I've also updated the repo so you can check @danielroe 😄 |
@LuXDAmore Sorry you're experiencing this. The issue is now that an outdated version of |
@danielroe I've tried to install the latest version of I've also noticed that the version 2 is a dependency from the |
Currently facing the same issue after upgrading my packages: Also tried directly installing unimport. Didn't change anything. However, I can reach my index page normally. As soon as I switch to another route the error occurs. Edit: This only happens to me when I'm running the app througg Update: I found out that deep in my app in a composable there still was an import from |
@Floppy012 how did you debugged it? I have some imports from |
In a totally un-elegant way. My root route worked but others didn't. So I took the page with least code and started to comment out things until it worked again. Then went into the component that broke the page and started the same thing over, then in the composable it was just a guess as I've had removed all the The only reason I used the imports was because WebStorm didn't support the way, that Nuxt uses to make the whole import-less stuff happen. |
@Floppy012 thank you very much, yes at the end the problem was caused by this row
Now i have just to handle with the ESLint warning telling me that Also thanks to you @danielroe ❤️ |
I just upgraded from v3.3.3 to v3.4.2 I wish I had not :( as I am getting lots of these same errors as well. Example: I know Nuxt is infamous for breaking errors on minor upgrades, but well... we keep trying ;))) |
@tvld do you have any imports from |
Nope, no imports at all with "#" (did not even know that's possible :))... I only use I managed to solve the errors either renaming all my |
I just created a new project with latest version of Nuxt 3.4.3. When I installed @nuxtjs/[email protected], I get similar issue: `Cannot restart nuxt: The requested module 'minimatch' does not provide an export named 'default' 22:06:02 import minimatch from 'minimatch'; |
Having the same issue with Github Actions (Node v18.15.0, pnpm v6) for Nuxt (Nuxt v3.3.3, Nuxt Content v2.5.2) but locally, it ran without a problem. One of my workflow steps where it occurred:
|
Can you upgrade to |
How do I fix this? @danielroe |
I've tried the optimizeDeps fix with no luck, and I'm trying to remove the #import and #app imports, however I get:
How do I import without these then if it throws errors like that? Am I just using the wrong import in general? |
I was importing jsonwebtoken into a module that had a Middleware for H3 Nitro server that was utilizing the package and another Middleware that was being used for my front-end that wasn't utilizing the package. Once the package was being imported from the module in my front-end Nuxt didn't like a Node Library being imported in the front-end and not server side. So I separated the two Middlewares and placed them in their recommended folders and everything is working now. |
still have the same issue on
|
I have this issue The requested module 'vite-plugin-inspect' does not provide an export named 'default' .
|
This worked for me. I had to remove devtools. Nuxt now needs to explicitly install vue and vue-router? Okkkk.... |
i was facing the same issue with a custom package and was able to resolve it with the following in (
|
Hi guys, I'm facing same error but with dayjs: The requested module '/_nuxt/node_modules/dayjs/plugin/advancedFormat.js?v=b8982373' does not provide an export named 'default' |
Same here, with vueform/nuxt module: nuxt.js?v=00be99e8:98 [nuxt] error caught during app initialization SyntaxError: The requested module '/_nuxt/node_modules/wnumb/wNumb.js?v=00be99e8' does not provide an export named 'default' (at useTooltip.js?v=00be99e8:2:8) |
Did you fixed the issue? I'm having the same problem with arraySupport |
it works for me export default defineNuxtConfig({
vite: {
optimizeDeps: {
include: [
"dayjs",
"dayjs/locale/zh-cn",
"dayjs/plugin/advancedFormat",
"dayjs/plugin/quarterOfYear",
"dayjs/plugin/customParseFormat",
"dayjs/plugin/isBetween",
"dayjs/plugin/weekOfYear",
"dayjs/plugin/weekYear",
],
},
}
}) |
Environment
Reproduction
here you can see a very simple reproduction link
https://stackblitz.com/edit/github-nl4dyg?file=app.vue
npm run dev
Describe the bug
I'm trying to use class-validator packages.
first I faced a problem mentioned here and solved it by adding this package to
build.transpile
innuxt.config.ts
file.then this error starts to show up
SyntaxError: The requested module '/_nuxt/node_modules/validator/lib/isLatLong.js?v=cba03522' does not provide an export named 'default'
the validator package is one of class-validator dependencies.
the weird part is that the code runs perfectly on the server process
and the error only occurs on the browser
and it works fine on both server and browser in production mode!
Additional context
No response
Logs
No response
The text was updated successfully, but these errors were encountered: