MCPcopy
hub / github.com/pmmmwh/react-refresh-webpack-plugin / normalizeOptions

Function normalizeOptions

lib/utils/normalizeOptions.js:8–37  ·  view source on GitHub ↗
(options)

Source from the content-addressed store, hash-verified

6 * @returns {import('../types').NormalizedPluginOptions} Normalized plugin options.
7 */
8const normalizeOptions = (options) => {
9 d(options, 'exclude', /node_modules/i);
10 d(options, 'include', /\.([cm]js|[jt]sx?|flow)$/i);
11 d(options, 'forceEnable');
12 d(options, 'library');
13
14 n(options, 'overlay', (overlay) => {
15 /** @type {import('../types').NormalizedErrorOverlayOptions} */
16 const defaults = {
17 entry: require.resolve('../../client/ErrorOverlayEntry'),
18 module: require.resolve('../../overlay'),
19 sockIntegration: 'wds',
20 };
21
22 if (overlay === false) {
23 return false;
24 }
25 if (typeof overlay === 'undefined' || overlay === true) {
26 return defaults;
27 }
28
29 d(overlay, 'entry', defaults.entry);
30 d(overlay, 'module', defaults.module);
31 d(overlay, 'sockIntegration', defaults.sockIntegration);
32
33 return overlay;
34 });
35
36 return options;
37};
38
39module.exports = normalizeOptions;

Callers 3

constructorMethod · 0.50

Calls 2

dFunction · 0.85
nFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…