async function enableHotReload(dir, config, subscribeReload = false) {
    let hotReloadEntryTemplate = join(__dirname, '../templates/entry-hot-reload.tmpl');
    let hotReloadEntryPath = join(dir, `${config.name}-hot-reload.js`);
    let templateContent = template(await readFile(hotReloadEntryTemplate, 'utf8'))({
        compilerName: config.name,
        subscribeReload
    });

    // generate .lavas/xxx-hot-reload.js
    await writeFileInDev(hotReloadEntryPath, templateContent);

    // add hot-reload entry in every entry
    Object.keys(config.entryPoints.entries()).forEach(entryKey => {
        config.entryPoints.get(entryKey).prepend(hotReloadEntryPath);
    });

    // add relative plugins
    config.plugin('hot-module-replacement').use(webpack.HotModuleReplacementPlugin).end()
        .plugin('no-emit-on-errors').use(webpack.NoEmitOnErrorsPlugin);
}
add support for hot reload, such as adding plugins and modifying every entry

@param {string} dir directory for hot-reload.js
@param {Object} config webpack config
@param {boolean} subscribeReload whether subscribe reload action