source: frontend/node_modules/@pmmmwh/react-refresh-webpack-plugin/lib/utils/normalizeOptions.js

Last change on this file was 9af201e, checked in by MBK <marija.karapandzova@…>, 12 days ago

Fix frontend appearance

  • Property mode set to 100644
File size: 1.2 KB
Line 
1const { d, n } = require('../../options');
2
3/**
4 * Normalizes the options for the plugin.
5 * @param {import('../types').ReactRefreshPluginOptions} options Non-normalized plugin options.
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 d(overlay, 'sockHost');
33 d(overlay, 'sockPath');
34 d(overlay, 'sockPort');
35 d(overlay, 'sockProtocol');
36 d(options, 'useURLPolyfill');
37
38 return overlay;
39 });
40
41 return options;
42};
43
44module.exports = normalizeOptions;
Note: See TracBrowser for help on using the repository browser.