normalizeOptions.js 634 B

12345678910111213141516171819202122232425
  1. const { d, n } = require('../../options');
  2. /**
  3. * Normalizes the options for the loader.
  4. * @param {import('../types').ReactRefreshLoaderOptions} options Non-normalized loader options.
  5. * @returns {import('../types').NormalizedLoaderOptions} Normalized loader options.
  6. */
  7. const normalizeOptions = (options) => {
  8. d(options, 'const', false);
  9. n(options, 'esModule', (esModule) => {
  10. if (typeof esModule === 'boolean' || typeof esModule === 'undefined') {
  11. return esModule;
  12. }
  13. d(esModule, 'include');
  14. d(esModule, 'exclude');
  15. return esModule;
  16. });
  17. return options;
  18. };
  19. module.exports = normalizeOptions;