An error has occurred during the Next.js build process: ReferenceError - The component is not defined

Encountering an error during the yarn build process, but no issues with yarn dev

My Typography component is custom-made, and I utilize absolute imports with the baseUrl option in tsconfig.json

next version: v9.5.2, typescript version: 3.9.7

See error output here

In need of assistance

Thank you.

Answer №1

Appreciation for all the feedback! The issue at hand turned out to be a coding problem. Following @bcjohn's suggestion, I discovered that yarn dev wasn't scanning all the files, leading me to identify the code problem.

The problematic code snippet was as follows:

export default {
  h1
}

Incorrect import statement:

<Typography.h1>

To resolve the code export issue, I made the following changes:

export default Typography;

And updated the import statement accordingly:

<Typography />

Similar questions

If you have not found the answer to your question or you are interested in this topic, then look at other similar questions below or use the search

Does anyone have an example of how to integrate Passport Google OAuth2 with Next.js?

If anyone has experience working with passport google oauth2 in a Next.js project, I would appreciate any examples of code you can share. While there are resources available for implementing this in Node.js, the specifics of routes, middleware, and callbac ...

Learning to implement forwardRef in MenuItem from Material-UI

Encountering an error when pressing Select due to returning MenuItem in Array.map. Code const MenuItems: React.FC<{ items: number[] }> = (props) => { const { items } = props; return ( <> {items.map((i) => { return ( ...

Setting up a middleware file for your nextJs project: A step-by-step guide

Currently, I am deep into a project that involves using Next.js. Progress has been steady so far, but there's a hitch with my middleware.ts file. Despite diligently following the Middleware documentation, it seems like the middleware is not triggering ...

Should the useRouter pathname be accessed in multiple components or passed as a prop for optimal Next.js performance?

Imagine a scenario where there is a Layout containing NavMobile and NavDtop components, each displaying based on screen size. In order to disable the link to the current page, both components require the current pathname from next/router. const router = us ...

Enhancing SEO with nextJs ServerSideProps for optimized HTML rendering

Having an issue with rendering HTML output in AG-Grid using NextJS getServerSideProps. When checking the source code, the rendered HTML is not there for SEO purposes. However, if I output the "staff" array to a div, then the HTML is visible in the source ...

When attempting to access the Next.js 13.5.0 package via the npm registry, the resource was not found

click here to view image error message: The file 'next@https://registry.npmjs.org/next/-/next-13.5.0.tgz' is not found in this registry. An issue has arisen during the deployment on Vercel. It was functioning properly just a short while ago, wi ...

Why is my Angular 2 app (TypeScript) not functioning properly?

My current project includes a component called EventListComponent import { Component } from 'angular2/core'; @Component ({ selector: 'el-events', templateUrl: 'app/events/event-list.component.html' }) export class E ...

Why is it that I am unable to retrieve a value from useContext?

How come I am unable to retrieve a value from useContext? I have already made an update. components/useContext/index.js import React, { useState } from "react"; import Article from "./article"; import status from "./status"; ...

Tips for maintaining selected text while a modal window is active

So I'm currently working on a document writer and I'm utilizing document.execCommand to insert links. What I aim for is the ability for a user to select/highlight text, click a button to add a link to that specific text (via a modal), and then ha ...

What is the best way to iterate through all class properties that are specified using class-validator?

I have a class defined using the class-validator package. class Shape { @IsString() value?: string @IsString() id?: string } I am trying to find a way to retrieve the properties and types specified in this class. Is there a method to do s ...

Can you explain how data fetching differs between refreshing the page and navigating to it?

I currently have a component named results.js, which is responsible for fetching data from our Back-end server. import { useRouter } from 'next/router'; import Navigation from '../../components/Navigation'; const Results = (props) => ...

"Encountering an issue with Next.js where the Redux

Hey there, I'm working on a simple project using Nextjs. I need to access the state of my Redux store but I'm encountering an error when trying to use store.getState, it's throwing an error saying getState is undefined. Additionally, I have ...

The name 'Queue' cannot be located in Typescript, error code ts(2304)

I'm currently trying to create a private variable of type InnerItem, but I keep encountering the following error: Error: Cannot find name 'Queue'.ts(2304) private savedItems: Queue<InnerItem> = new Queue<InnerItem>(20); Could ...

I'm perplexed as to why my array remains empty despite assigning a value to it in my controller. (Just to clarify, I am working with AngularJS, not Angular)

I spent a whole day debugging this issue without any luck. Issue: this.gridOptions.data = this.allTemplatesFromClassificationRepo ; **this.allTemplatesFromClassificationRepo ** remains an empty array. I have already called the activate() function to assig ...

Combining multiple tables in Supabase using JavaScript

I currently have 3 tables stored in supabase: Message --> connected with a foreign key 'request_id' to the Product_Request table Product_Request --> linked with a foreign key 'product_id' to the Product table Product My main iss ...

Implementing various custom validation techniques in Angular 2

I am encountering an issue with adding multiple custom validations to a form. Currently, I am only able to add a single custom validation to my form. How can I include multiple validations? For example: this.user = this.fb.group({ name: ['', ...

The header component does not update properly post-login

I am currently developing a web-app using Angular 8. Within my app, I have a header and login page. My goal is to update the header after a user logs in to display information about the current logged-in user. I attempted to achieve this using a BehaviorS ...

Struggling with loading.jsx file in next js version 13.4.5?

Encountered an issue with loading components in next js 13.4.5 layout.jsx "use client"; import React, { Suspense } from "react"; import { ThemeProvider, createTheme } from "@mui/material/styles"; import CssBaseline from " ...

Error: `target` property is not recognized on `htmlelement` type

I am attempting to retrieve the ID of a list item in a select menu but I am having trouble getting the value from it. The value should be a number. HTML File <div class="form-group mt-3"> <label class="form-label">Produc ...

I'm encountering an issue while trying to retrieve NFTs from a contract on the marketplace

Unhandled Issue at Runtime Error Type: TypeError - contract?.getAddress is not a function Stack Trace: useActiveListings Error occurred in webpack-internal:///./node_modules/@thirdweb-dev/react-core/dist/useTransactions-07d3933d.browser.esm.js (3764:37) ...