我正在使用webpack并做出反应 . 我有一个应用程序,我有一个组件库,我导入到应用程序 .

在组件库index.js中,我单独导出每个组件

export componentA from './ComponentA';
export componentB from './ComponentB';

在我的应用程序中,我从lib导入组件

import { componentA } from 'componentLib';

How can I hot reload component A? 目前我明白了

The following modules couldn't be hot updated: (Full reload needed) This is usually because the modules which have changed (and their parents) do not know how to hot reload themselves

Update 1

所以下面的工作与警告..这似乎充当了所有,并将重新渲染一切,但它打破其他热门更新,如 module.hot.accept('./sagas', () => {...}) . 它说传奇仍在更新,但这些变化不会长期发挥作用

module.hot.accept();

  if (shouldBreak) {
    shouldBreak = false;
  } else {
    const nextRoot = require('containers/Root').default; //eslint-disable-line
    render(nextRoot);
  }