小编Lin*_*ins的帖子

Gatsby - Warn Attempted import error: 'css' does not contain a default export (imported as 'styles')

I Was beginning with Gatsby, and in my app, when I run the command 'gatsby develop', I got this warning in terminal:

warn Attempted import error: '../styles/home.module.css' does not contain a default export (imported as 'styles').

And then, when I´m trying to load a page, It´s not possible

Unhandled Runtime Error 
Cannot read property 'header' of undefined 
<section className={styles.header}>
Run Code Online (Sandbox Code Playgroud)

This is part of my code (file index.js):

import styles from '../styles/home.module.css'

export default function Home({ data }) {
  return ( …
Run Code Online (Sandbox Code Playgroud)

reactjs css-modules gatsby

5
推荐指数
1
解决办法
1523
查看次数

标签 统计

css-modules ×1

gatsby ×1

reactjs ×1