I've been trying to work with next.js right now and when I imported a navbar component to my _app.tsx and run the project, it would give me an error of saying "Cannot use import statement outside a module." This doesn't occur on vanilla React though.
What I did is I made a Navbar component in components folder.
navbar.tsx
//some imports on react-bootstrap
function NavigationBar(): JSX:Element {
<>
//Navbar code
</>
on my _app.tsx, I imported the Navbar so that it would be accessible to all pages of the app.
_app.tsx
import type { AppProps } from 'next/app'
import NavigationBar from "../components/navbar.tsx"
function MyApp({ Component, pageProps }: AppProps) {
return (
<>
<NavigationBar/>
<Component {...pageProps} />
</>
)
}
It didn't highlight any error until I tried to run the project.
The error seems to occur in the bootstrap folder in node_modules though.
Attached is the error log on the console.

Thanks in advance.