defineConfig.js 1.0 KB

123456789101112131415161718192021222324252627282930313233343536373839
  1. /*
  2. MIT License http://www.opensource.org/licenses/mit-license.php
  3. Author Alexander Akait @alexander-akait
  4. */
  5. "use strict";
  6. /**
  7. * @import {
  8. * WebpackOptions as Configuration
  9. * } from "../../declarations/WebpackOptions"
  10. */
  11. /**
  12. * @import {
  13. * MultiWebpackOptions as MultiConfiguration
  14. * } from "../MultiCompiler"
  15. */
  16. /**
  17. * @template T
  18. * @typedef {T | Promise<T>} MaybePromise
  19. */
  20. /**
  21. * Function style configuration, called with the `--env` values and CLI arguments.
  22. * @typedef {(env: Record<string, EXPECTED_ANY>, argv: Record<string, EXPECTED_ANY>) => MaybePromise<Configuration | MultiConfiguration>} ConfigurationFactory
  23. */
  24. /** @typedef {MaybePromise<Configuration | MultiConfiguration | ConfigurationFactory | ConfigurationFactory[]>} DefineConfigInput */
  25. /**
  26. * A type helper for authoring configuration files, no-op at runtime.
  27. * @template {DefineConfigInput} T
  28. * @param {T} config webpack configuration
  29. * @returns {T} the same configuration
  30. */
  31. const defineConfig = (config) => config;
  32. module.exports = defineConfig;