plugin-config.js 1.2 KB

1234567891011121314151617181920212223242526
  1. "use strict";
  2. Object.defineProperty(exports, "__esModule", { value: true });
  3. exports.createPluginConfig = void 0;
  4. const formatter_1 = require("./formatter");
  5. const infrastructure_logger_1 = require("./infrastructure-logger");
  6. const issue_config_1 = require("./issue/issue-config");
  7. const type_script_worker_config_1 = require("./typescript/type-script-worker-config");
  8. function createPluginConfig(compiler, options = {}) {
  9. return {
  10. async: options.async === undefined ? compiler.options.mode === 'development' : options.async,
  11. typescript: (0, type_script_worker_config_1.createTypeScriptWorkerConfig)(compiler, options.typescript),
  12. issue: (0, issue_config_1.createIssueConfig)(compiler, options.issue),
  13. formatter: (0, formatter_1.createFormatterConfig)(options.formatter),
  14. logger: options.logger === 'webpack-infrastructure'
  15. ? (() => {
  16. const { info, error } = (0, infrastructure_logger_1.getInfrastructureLogger)(compiler);
  17. return {
  18. log: info,
  19. error,
  20. };
  21. })()
  22. : options.logger || console,
  23. devServer: options.devServer !== false,
  24. };
  25. }
  26. exports.createPluginConfig = createPluginConfig;