@tus/server production build error
[nitro] [uncaughtException] Class extends value [object Module] is not a constructor or null
6 Replies
Hi @Serhii Chernenko. I'm kapa.ai, your friendly support bot. I will try to answer your question by searching through the knowledge base. :wave:
----------------------
Based on the information provided in the knowledge sources, I don't have enough specific details to directly address the "@tus/server production build error" you're encountering. However, I can provide some general insights about Nuxt and error handling that might be relevant:
The error message you're seeing ("Class extends value [object Module] is not a constructor or null") suggests there might be an issue with how a module is being imported or used in your Nuxt application. This type of error can sometimes occur when there's a mismatch between CommonJS and ES modules.
Here are a few things you could consider:
1. Check your Nuxt version: Make sure you're using the latest stable version of Nuxt, as some issues might have been resolved in recent updates.
2. Review your module imports: Ensure that all your imports, especially for @tus/server, are correctly formatted and compatible with your Nuxt setup.
3. Examine your build configuration: The error is occurring during the production build, so there might be an issue specific to the build process.
4. Look into Nuxt's error handling: Nuxt provides various ways to handle errors, which might help you debug this issue. You can refer to the Error Handling documentation for more information.
5. Check for compatibility: Ensure that @tus/server is compatible with your Nuxt version and setup.
If the problem persists, you might want to create a minimal reproduction of the issue and seek help from the Nuxt community or the maintainers of the @tus/server package.
Remember, for more accurate assistance, it would be helpful to have more details about your specific setup, Nuxt version, and the relevant parts of your code where you're using @tus/server.
----------------------
Note: you can ask me a follow up question by @ mentioning me again :speech_balloon:
----------------------
<@621765864886108181> Kapa.ai is still learning and improving, please let me know how I did by reacting below.
I guess the issue is related to cloudflare pages preset in nitro when it's deployed with nuxthub integration.
there's the same mention
https://community.cloudflare.com/t/typeerror-class-extends-value-undefined-is-not-a-constructor-or-null/355092
I tried to add in during development
build: {
transpile: ['@tus/server', '@tus/file-store'],
},
and have the error even in dev mode but it's different
[500] Cannot access 'renderer$1' before initialization
@kapa.ai check the message above
Let me check the knowledge base for you again. One moment! :books:
----------------------
I apologize for the confusion in my previous response. Let me address the specific error message you provided:
"[nitro] [uncaughtException] Class extends value [object Module] is not a constructor or null"
This error message is indeed related to Nuxt and its Nitro server. Based on the knowledge sources provided, I can offer some insights and potential solutions:
1. Version compatibility: This issue might be related to a specific Nuxt version. According to the Github Issue #29354, a similar error was reported and resolved in Nuxt version 3.15.3. If you're using an older version, consider upgrading to the latest stable release of Nuxt.
2. Server-side rendering (SSR) issues: The error suggests a problem with class extension, which could be related to how modules are being loaded or used in the server-side context. This is particularly relevant if you're using server components or SSR features.
3. Module compatibility: Ensure that all your modules, including any custom ones, are compatible with the version of Nuxt you're using. Some modules might need to be updated or configured differently for production builds.
4. Build configuration: Check your
nuxt.config.ts
file for any settings that might affect the production build process. Pay special attention to any custom Vite or webpack configurations if you have them.
5. Workaround for development: If you're encountering this issue in the development environment, you might try adding the following to your nuxt.config.ts
file as a temporary workaround:
However, as mentioned in the Github Issue #30749, this workaround should be wrapped in a $development
condition to avoid affecting production builds.
6. Check for circular dependencies: Although not directly mentioned in the error, circular dependencies can sometimes cause similar issues. You can use tools like dpdm
to check for circular dependencies in your project.
If the problem persists after trying these suggestions, it would be helpful to create a minimal reproduction of the issue and share it with the Nuxt community or open an issue on the Nuxt GitHub repository for more specific assistance.
----------------------
Note: you can ask me a follow up question by @ mentioning me again :speech_balloon:
----------------------<@621765864886108181> Kapa.ai is still learning and improving, please let me know how I did by reacting below.
@Serhii Chernenko hard to help without more info I'm afraid