我使用此初学者包https://github.com/wellyshen/react-cool-starter
将组件UserList插入到Home容器
当我尝试使用导入注释此字段时。 import UserList from '../../components/UserList'
;我有错误,我需要删除此组件
[webpack-isomorphic-tools] [error] asset not found: ./src/components/UserList/styles.scss
==> Rendering routes error: TypeError: Cannot read property '_style' of undefined
我只是删除导入,为什么会发生?
UserList组件
import React from 'react';
import { Link } from 'react-router-dom';
import styles from './styles.scss';
type Props = { list: Array<Object> };
const UserList = ({ list }: Props) => (
<div className={styles.UserList}>
<h4>User List</h4>
<ul>
{list.map(user => (
<li key={user.id}>
<Link to={`/UserInfo/${user.id}`}>{user.name}1111</Link>
</li>
))}
</ul>
</div>
);
UserList.defaultProps = {
list: {
id: '',
name: '',
},
};
export default UserList;
SCSS USERLIST
@import&#39; ../../ theme / variables&#39;;
.UserList {
color: $color-white;
ul {
padding-left: 17px;
li {
margin-bottom: 0.5em;
}
}
a {
color: $color-white;
}
}
答案 0 :(得分:0)
问题在于Utils / html.js
有重新require('../components/UserList/styles.scss')._style +