UNPKG

@pmmmwh/react-refresh-webpack-plugin

Version:

An **EXPERIMENTAL** Webpack plugin to enable "Fast Refresh" (also previously known as _Hot Reloading_) for React components.

31 lines (28 loc) 897 B
/** * Gets the socket integration to use for Webpack messages. * @param {'wds' | 'whm' | 'wps' | string} integrationType A valid socket integration type or a path to a module. * @returns {string} Path to the resolved socket integration module. */ function getSocketIntegration(integrationType) { let resolvedSocketIntegration; switch (integrationType) { case 'wds': { resolvedSocketIntegration = require.resolve('../../sockets/WDSSocket'); break; } case 'whm': { resolvedSocketIntegration = require.resolve('../../sockets/WHMEventSource'); break; } case 'wps': { resolvedSocketIntegration = require.resolve('../../sockets/WPSSocket'); break; } default: { resolvedSocketIntegration = require.resolve(integrationType); break; } } return resolvedSocketIntegration; } module.exports = getSocketIntegration;