1.0.3 • Published 2 years ago

@project-tool/plugin-hot-update v1.0.3

Weekly downloads
-
License
ISC
Repository
-
Last release
2 years ago

安装依赖

yarn add react-hot-loader 
yarn add @project-tool/plugin-hot-update

在配置文件中 plugins 属性中添加

{
    ...otherConfigs,
    plugins: [
        ...otherPlugins,
        [
            '@project-tool/plugin-hot-update',
            {
                root: ['./src/']
            }   
        ]
    ]
}

针对需要热更新的组件, 手动添加hot方法

import { hot } from 'react-hot-loader/root';
const App = () => <div>Hello World!</div>;
export default hot(App);

或指定文件,自动添加

{
    ...otherConfigs,
    plugins: [
        ...otherPlugins,
        [
            '@project-tool/plugin-hot-update',
            {
                appKey: string,
                root: string[]
            }   
        ]
    ]
}