While experimenting with the boilerplate template, I encountered an unusual issue when attempting to use TypeScript with the default NextJS configuration. The problem arose when changing the file extension from .js
to .tsx
/ .tsx
. Various versions of NextJS from 13 to the most recent were tested, along with TypeScript 5 and 4.
Error - ./pages/_app.tsx:1:0
Module not found: Can't resolve '@/styles/globals.css'
> 1 | import '@/styles/globals.css'
2 | import { Analytics } from '@vercel/analytics/react'
3 |
4 | export default function App({ Component, pageProps }) {
https://nextjs.org/docs/messages/module-not-found
When I attempt to command+click the file in VSCode, it cannot be located. However, renaming the file to Globals.module.css,
resolves this issue. Yet, the error persists: module not found.
Any suggestions?
Check out the related GitHub Issue.
Related: Module not found: Can't resolve '@styles/globals.css'