get-plugins.js 684 B

12345678910111213
  1. "use strict";
  2. Object.defineProperty(exports, "__esModule", { value: true });
  3. exports.getPlugins = getPlugins;
  4. const default_1 = require("./plugins/default");
  5. function getPlugins(options) {
  6. // don't load default errorResponsePlugin if user has specified their own
  7. const maybeErrorResponsePlugin = options.on?.error ? [] : [default_1.errorResponsePlugin];
  8. const defaultPlugins = options.ejectPlugins
  9. ? [] // no default plugins when ejecting
  10. : [default_1.debugProxyErrorsPlugin, default_1.proxyEventsPlugin, default_1.loggerPlugin, ...maybeErrorResponsePlugin];
  11. const userPlugins = options.plugins ?? [];
  12. return [...defaultPlugins, ...userPlugins];
  13. }