WebpackOptionsDefaulter.js 818 B

1234567891011121314151617181920212223242526
  1. /*
  2. MIT License http://www.opensource.org/licenses/mit-license.php
  3. Author Tobias Koppers @sokra
  4. */
  5. "use strict";
  6. const { applyWebpackOptionsDefaults } = require("./config/defaults");
  7. const { getNormalizedWebpackOptions } = require("./config/normalization");
  8. /** @typedef {import("./config/normalization").WebpackOptions} WebpackOptions */
  9. /** @typedef {import("./config/normalization").WebpackOptionsNormalized} WebpackOptionsNormalized */
  10. class WebpackOptionsDefaulter {
  11. /**
  12. * @param {WebpackOptions} options webpack options
  13. * @returns {WebpackOptionsNormalized} normalized webpack options
  14. */
  15. process(options) {
  16. const normalizedOptions = getNormalizedWebpackOptions(options);
  17. applyWebpackOptionsDefaults(normalizedOptions);
  18. return normalizedOptions;
  19. }
  20. }
  21. module.exports = WebpackOptionsDefaulter;