Nuxt Debug Named default
Hi,
I have recompiled my project today and suddenly getting an error such as:
The requested module 'http://localhost:5173/_nuxt/node_modules/debug/src/browser.js?v=46864f77' doesn't provide an export named: 'default'
I have definitly no clue were to look for. Any hint/help is much appreciated.
THis error appears when navigating to a specific page on my project.
Commenting
import type { ExtractedTextSection, SourceOrigin } from '~/types/project'
// import { parseMarkdown } from '@nuxtjs/mdc/runtime'
import SectionCard from '~/components/projects/SectionCard.vue'
import type { MDCParserResult } from '@nuxtjs/mdc'
Remove the issue so looks like it's the mdc libs
2 Replies
Hi @lixs. I'm kapa.ai, your friendly support bot. I will try to answer your question by searching through the knowledge base. :wave:
----------------------
The error message you're seeing:
The requested module 'http://localhost:5173/_nuxt/node_modules/debug/src/browser.js?v=46864f77' doesn't provide an export named: 'default'suggests that there is an issue with how the
debug
package is being imported in your Nuxt project. This is typically related to differences between CommonJS and ES Module exports.
According to the Nuxt documentation, such errors can occur if a package is authored in CommonJS but is being imported as an ES Module, or vice versa. For example, if you try to import a named export from a CommonJS module, Node.js (and Vite, which Nuxt uses) may not find the export as expected. The recommended way to import from a CommonJS module is to use the default import and then destructure as needed:
If you are importing debug
like this:
but the package does not provide a default export, you may need to adjust your import to:
or, if using CommonJS syntax:
This kind of issue is discussed in the Nuxt documentation about ES Modules and CommonJS interop, which explains the root cause and how to resolve it by adjusting your import statements appropriately. You should review your imports for the debug
package and ensure they match the module's export style. If the error only appears after recompiling or updating dependencies, it's possible that a package update changed the export style, or your build tool's handling of ESM/CJS interop has changed. Double-check your dependencies and their versions as well What Kinds of Problems Can There Be?.
If you need to debug further, enabling Nuxt's debug mode may provide more detailed logs:
or for granular control:
Nuxt Configuration: debug.
If the issue persists after adjusting your imports, please check if any recent changes to your dependencies or build configuration could have affected module resolution.
----------------------
Note: you can ask me a follow up question by @ mentioning me again :speech_balloon:
----------------------<@787995685873778689> Kapa.ai is still learning and improving, please let me know how I did by reacting below.