const FastRefreshPlugin = require('@pmmmwh/react-refresh-webpack-plugin/lib'); const { MFSU_NAME } = require('../constants'); const { Env } = require('../types'); module.exports = async function addFastRefreshPlugin(opts) { const { config, userConfig, name } = opts; const isDev = opts.env === Env.development; const useFastRefresh = isDev && userConfig.fastRefresh !== false && name !== MFSU_NAME; if (useFastRefresh) { config .plugin('fastRefresh') .after('hmr') .use(FastRefreshPlugin, [{ overlay: false }]); } };