'Module not found in App.js when deploying
does anyone have any clue why im getting this error when deploying and how i can fix it?
./pages/_app.js Module not found: Can't resolve '../components' in '/vercel/path0/pages'
import React from "react";
import { Toaster } from "react-hot-toast";
import { Layout } from "../components";
import "../styles/globals.css";
import { StateContext } from "../context/StateContext";
function MyApp({ Component, pageProps }) {
return (
<StateContext>
<Layout>
<Toaster />
<Component {...pageProps} />
</Layout>
</StateContext>
);
}
export default MyApp;
This is the code for the layout part of component
import React from "react";
import Head from "next/head";
import Navbar from "./Navbar";
import Footer from "./Footer";
const Layout = ({ children }) => {
return (
<div className="layout">
<Head>
<title>My Store Front</title>
</Head>
<header>
<Navbar />
</header>
<main className="main-container">{children}</main>
<footer>
<Footer />
</footer>
</div>
);
};
export default Layout;
Index.js (barrel folder)
export { default as Footer } from "./Footer";
export { default as Layout } from "./Layout";
export { default as Navbar } from "./Navbar";
export { default as Product } from "./Product";
export { default as HeroBanner } from "./HeroBanner";
export { default as FooterBanner } from "./FooterBanner";
export { default as Cart } from "./Cart";
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
