While starting with Gatsby, I encountered an issue in my app where running the command 'gatsby develop' resulted in a warning in the terminal:
warn Attempted import error: '../styles/home.module.css' does not contain a default export (imported as 'styles').
Subsequently, when attempting to load a page, it failed with the following runtime error:
Unhandled Runtime Error
Cannot read property 'header' of undefined
<section className={styles.header}>
The code snippet causing the issue is from my index.js file:
import styles from '../styles/home.module.css'
export default function Home({ data }) {
return (
<Layout>
<section className={styles.header}>
Here is a portion of my CSS module from the home.module.css file:
.header {
display: grid;
grid-template-columns: 1fr 1fr;
grid-gap: 40px;
align-items: center;
}
I am unsure what could be wrong with my CSS Module. Any insights?