umi4 页面组件导出的是匿名函数会导致hmr失效

294 阅读1分钟
export default function() {
  return (
    <div>
      <h1 className={styles.title}>Page index</h1>
    </div>
  );
}

页面组件导出的是上面的这种匿名函数会导致hmr失效,任何小修改都会导致page reload ,应该是hot replace

export default function Page() {
  return (
    <div>
      <h1 className={styles.title}>Page index</h1>
    </div>
  );
}

如果导出的是上面这种具名函数,hmr则是正常的