UNPKG

@wjunt/webpack-config

Version:

Presets of webpack config

25 lines (24 loc) 725 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); const utils_1 = require("../common/utils"); function hotReload(entry) { if (!utils_1.isDevelopment()) { return entry; } if (typeof entry === 'function') { const entryFunc = entry; return (async () => hotReload(await entryFunc())); } if (typeof entry === 'string') { entry = [entry]; } if (Array.isArray(entry)) { entry.unshift('webpack-hot-client/client'); return entry; } return Object.entries(entry).reduce((entryObject, [name, source]) => { entryObject[name] = hotReload(source); return entryObject; }, {}); } exports.hotReload = hotReload;