Search code examples
next.jsvercel

Cannot find module or type declarations while it works in local build


I keep getting this error when trying to build my app on Vercel, while it works locally without problems.

Here is the error message

Cannot find module Type error: Cannot find module './sidenav/SideNav' or its corresponding type declarations.

At this line

import SideNav from "./sidenav/SideNav"

While import this works fine in the same component

import NavigationBar from "./navigationBar/NavigationBar"

My SideNav is nothing special

const SideNav = () => {

  return (
    <>
      <div></div>
    </>
  );
};

export default SideNav;

Any idea on what the problem could be?


Solution

  • After some testing, changing the folder to ./sideNav/SideNav instead of ./sidenav/SideNav works even if the initial import naming was correct in the name